mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Create images directory if doesn't exist, to store image search results
This commit is contained in:
parent
a29af70de5
commit
4d5183063c
1 changed files with 4 additions and 0 deletions
|
@ -190,6 +190,10 @@ def collate_results(hits, image_names, output_directory, image_files_url, count=
|
|||
target_image_name = f"{index}{source_path.suffix}"
|
||||
target_path = resolve_absolute_path(f"{output_directory}/{target_image_name}")
|
||||
|
||||
# Create output directory, if it doesn't exist
|
||||
if not target_path.parent.exists():
|
||||
target_path.parent.mkdir(exist_ok=True)
|
||||
|
||||
# Copy the image to the output directory
|
||||
shutil.copy(source_path, target_path)
|
||||
|
||||
|
|
Loading…
Reference in a new issue