Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ def query(query_index, query_domain):
|
|
| 38 |
dst_img_path = os.path.join(data_root, dst_data[0][query_index])
|
| 39 |
img_paths = [dst_img_path]
|
| 40 |
q_cl = dst_img_path.split('/')[-2]
|
| 41 |
-
captions = [f'Query: {q_cl}']
|
| 42 |
for s_domain, s_data in src_data_dict.items():
|
| 43 |
_, top_n_matches_ids = s_data[1].kneighbors(dst_data[1][query_index:query_index+1])
|
| 44 |
top_n_labels = s_data[0][2][top_n_matches_ids][0]
|
|
@@ -48,7 +48,7 @@ def query(query_index, query_domain):
|
|
| 48 |
for p in src_img_pths:
|
| 49 |
src_cl = p.split('/')[-2]
|
| 50 |
src_file = p.split('/')[-1]
|
| 51 |
-
captions.append(src_cl)
|
| 52 |
print(img_paths)
|
| 53 |
return tuple([p for p in img_paths])+ tuple(captions)
|
| 54 |
|
|
@@ -60,9 +60,14 @@ with demo:
|
|
| 60 |
slider = gr.Slider(0, 1000)
|
| 61 |
image_button = gr.Button("Run")
|
| 62 |
|
| 63 |
-
gr.
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
out_images = []
|
|
|
|
| 38 |
dst_img_path = os.path.join(data_root, dst_data[0][query_index])
|
| 39 |
img_paths = [dst_img_path]
|
| 40 |
q_cl = dst_img_path.split('/')[-2]
|
| 41 |
+
captions = [f'Query: {q_cl}'.title()]
|
| 42 |
for s_domain, s_data in src_data_dict.items():
|
| 43 |
_, top_n_matches_ids = s_data[1].kneighbors(dst_data[1][query_index:query_index+1])
|
| 44 |
top_n_labels = s_data[0][2][top_n_matches_ids][0]
|
|
|
|
| 48 |
for p in src_img_pths:
|
| 49 |
src_cl = p.split('/')[-2]
|
| 50 |
src_file = p.split('/')[-1]
|
| 51 |
+
captions.append(src_cl.title())
|
| 52 |
print(img_paths)
|
| 53 |
return tuple([p for p in img_paths])+ tuple(captions)
|
| 54 |
|
|
|
|
| 60 |
slider = gr.Slider(0, 1000)
|
| 61 |
image_button = gr.Button("Run")
|
| 62 |
|
| 63 |
+
with gr.Row():
|
| 64 |
+
gr.Markdown('# Query Image: \t\t\t\t ')
|
| 65 |
+
gr.Markdown('\t')
|
| 66 |
+
gr.Markdown('\t')
|
| 67 |
+
gr.Markdown('\t')
|
| 68 |
+
with gr.Column():
|
| 69 |
+
src_cap = gr.Label()
|
| 70 |
+
src_img = gr.Image()
|
| 71 |
|
| 72 |
|
| 73 |
out_images = []
|