Eun0 commited on
Commit
a363bd1
1 Parent(s): 90b7ac6

Add dataset name mapping

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -32,8 +32,15 @@ The code is based on [clip-retrieval](https://github.com/rom1504/clip-retrieval)
32
  # From huggingface dataset
33
  from huggingface_hub import hf_hub_download, snapshot_download
34
 
 
 
 
 
 
35
  def load_faiss_index(dataset):
36
  index_dir = "data/faiss_index"
 
 
37
  hf_hub_download(
38
  repo_id="Eun02/text_image_faiss_index",
39
  subfolder=dataset,
@@ -106,7 +113,7 @@ with gr.Blocks() as demo:
106
  gr.Markdown(description)
107
 
108
  with gr.Row():
109
- dataset = gr.Dropdown(label="dataset", choices=["booru22", "DiffusionDB"], value="DiffusionDB")
110
  top_k = gr.Slider(label="top k", minimum=1, maximum=20, value=8)
111
  show_score = gr.Checkbox(label="Show score", value=True)
112
  query_text = gr.Textbox(label="query text")
 
32
  # From huggingface dataset
33
  from huggingface_hub import hf_hub_download, snapshot_download
34
 
35
+ DATASET_NAME = {
36
+ "danbooru22": "booru22_000-300",
37
+ "DiffusionDB": "diffusiondb",
38
+ }
39
+
40
  def load_faiss_index(dataset):
41
  index_dir = "data/faiss_index"
42
+ dataset = DATASET_NAME[dataset]
43
+
44
  hf_hub_download(
45
  repo_id="Eun02/text_image_faiss_index",
46
  subfolder=dataset,
 
113
  gr.Markdown(description)
114
 
115
  with gr.Row():
116
+ dataset = gr.Dropdown(label="dataset", choices=["danbooru22", "DiffusionDB"], value="DiffusionDB")
117
  top_k = gr.Slider(label="top k", minimum=1, maximum=20, value=8)
118
  show_score = gr.Checkbox(label="Show score", value=True)
119
  query_text = gr.Textbox(label="query text")