mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Ease access to image result for given query by image_search
- Copy images to accessible directory - Return URL paths to them to ease access - This is to be used in the web interface to render image results directly in browser - Return image, metadata scores for each image in response as well This should help get a better sense of image scores along both XMP metadata and whole image axis
This commit is contained in:
@@ -82,13 +82,16 @@ def search(q: str, n: Optional[int] = 5, t: Optional[SearchType] = None):
|
||||
if (t == SearchType.Image or t == None) and model.image_search:
|
||||
# query transactions
|
||||
hits = image_search.query(user_query, results_count, model.image_search)
|
||||
output_directory = f'{os.getcwd()}/{web_directory}'
|
||||
|
||||
# collate and return results
|
||||
return image_search.collate_results(
|
||||
hits,
|
||||
model.image_search.image_names,
|
||||
config.content_type.image.input_directory,
|
||||
results_count)
|
||||
image_names=model.image_search.image_names,
|
||||
image_directory=config.content_type.image.input_directory,
|
||||
output_directory=output_directory,
|
||||
static_files_url='/static',
|
||||
count=results_count)
|
||||
|
||||
else:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user