mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Remove unused render_results method from text and image search
It's a relic from when khoj was being used as a python module
This commit is contained in:
parent
afcfc3cd62
commit
cf7400759b
2 changed files with 0 additions and 28 deletions
|
@ -193,16 +193,6 @@ def query(raw_query, count, model: ImageSearchModel):
|
|||
return sorted(hits, key=lambda hit: hit["score"], reverse=True)
|
||||
|
||||
|
||||
def render_results(hits, image_names, image_directory, count):
|
||||
image_directory = resolve_absolute_path(image_directory, strict=True)
|
||||
|
||||
for hit in hits[:count]:
|
||||
print(image_names[hit['corpus_id']])
|
||||
image_path = image_directory.joinpath(image_names[hit['corpus_id']])
|
||||
with Image.open(image_path) as img:
|
||||
img.show()
|
||||
|
||||
|
||||
def collate_results(hits, image_names, output_directory, image_files_url, count=5) -> list[SearchResponse]:
|
||||
results: list[SearchResponse] = []
|
||||
|
||||
|
|
|
@ -125,24 +125,6 @@ def query(raw_query: str, model: TextSearchModel, rank_results: bool = False):
|
|||
return hits, entries
|
||||
|
||||
|
||||
def render_results(hits, entries: list[Entry], count=5, display_biencoder_results=False):
|
||||
"Render the Results returned by Search for the Query"
|
||||
if display_biencoder_results:
|
||||
# Output of top hits from bi-encoder
|
||||
print("\n-------------------------\n")
|
||||
print(f"Top-{count} Bi-Encoder Retrieval hits")
|
||||
hits = sorted(hits, key=lambda x: x['score'], reverse=True)
|
||||
for hit in hits[0:count]:
|
||||
print(f"Score: {hit['score']:.3f}\n------------\n{entries[hit['corpus_id']].compiled}")
|
||||
|
||||
# Output of top hits from re-ranker
|
||||
print("\n-------------------------\n")
|
||||
print(f"Top-{count} Cross-Encoder Re-ranker hits")
|
||||
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
||||
for hit in hits[0:count]:
|
||||
print(f"CrossScore: {hit['cross-score']:.3f}\n-----------------\n{entries[hit['corpus_id']].compiled}")
|
||||
|
||||
|
||||
def collate_results(hits, entries: list[Entry], count=5) -> list[SearchResponse]:
|
||||
return [SearchResponse.parse_obj(
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue