Spaces:
Runtime error
Runtime error
Remove unused package
Browse files
app.py
CHANGED
|
@@ -4,7 +4,6 @@ import pandas as pd
|
|
| 4 |
import faiss
|
| 5 |
import clip
|
| 6 |
import torch
|
| 7 |
-
from datasets import load_dataset
|
| 8 |
|
| 9 |
title = r"""
|
| 10 |
<h1 align="center" id="space-title"> 🔍 Search Similar Text/Image in the Dataset</h1>
|
|
@@ -88,9 +87,10 @@ def search_text(dataset, top_k, show_score, query_text, device):
|
|
| 88 |
result_str += f", {score:0.2f}"
|
| 89 |
result_str += "\n"
|
| 90 |
|
| 91 |
-
file_name = query_text.replace(" ", "_")
|
| 92 |
-
if show_score:
|
| 93 |
-
|
|
|
|
| 94 |
output_path = f"./{file_name}.txt"
|
| 95 |
with open(output_path, "w") as f:
|
| 96 |
f.writelines(result_str)
|
|
|
|
| 4 |
import faiss
|
| 5 |
import clip
|
| 6 |
import torch
|
|
|
|
| 7 |
|
| 8 |
title = r"""
|
| 9 |
<h1 align="center" id="space-title"> 🔍 Search Similar Text/Image in the Dataset</h1>
|
|
|
|
| 87 |
result_str += f", {score:0.2f}"
|
| 88 |
result_str += "\n"
|
| 89 |
|
| 90 |
+
# file_name = query_text.replace(" ", "_")
|
| 91 |
+
# if show_score:
|
| 92 |
+
# file_name += "_score"
|
| 93 |
+
file_name = "output"
|
| 94 |
output_path = f"./{file_name}.txt"
|
| 95 |
with open(output_path, "w") as f:
|
| 96 |
f.writelines(result_str)
|