Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -96,17 +96,37 @@ def find_best_matches(image, mode, text):
|
|
96 |
return matched_images
|
97 |
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
label="Generated images",
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
|
|
96 |
return matched_images
|
97 |
|
98 |
|
99 |
+
iface = gr.Interface(
|
100 |
+
fn=find_best_matches,
|
101 |
+
inputs=[
|
102 |
+
gr.Image(label="Image to search"),
|
103 |
+
gr.Radio([T2I, I2I], label="Search Mode"),
|
104 |
+
gr.Textbox(lines=1, label="Text Query", placeholder="Introduce the search text...")
|
105 |
+
],
|
106 |
+
theme="grass",
|
107 |
+
outputs=[
|
108 |
+
gr.Gallery(
|
109 |
+
label="Generated images",
|
110 |
+
show_label=False,
|
111 |
+
elem_id="gallery"
|
112 |
+
).style(grid=[2], height="auto")
|
113 |
+
],
|
114 |
+
enable_queue=True,
|
115 |
+
title="CLIP Image Search",
|
116 |
+
description="This application displays TOP THREE images from Unsplash dataset that best match the search query provided by the user. Moreover, the input can be provided via two modes: text or image form."
|
117 |
+
)
|
118 |
+
|
119 |
+
iface.launch()
|
120 |
+
|
121 |
+
# gr.Interface(fn=find_best_matches,
|
122 |
+
# inputs=[
|
123 |
+
# gr.Image(label="Image to search"),
|
124 |
+
# gr.Radio([T2I, I2I]),
|
125 |
+
# gr.Textbox(lines=1, label="Text query", placeholder="Introduce the search text...",
|
126 |
+
# )],
|
127 |
+
# theme="grass",
|
128 |
+
# outputs=[gr.Gallery(
|
129 |
+
# label="Generated images", show_label=False, elem_id="gallery"
|
130 |
+
# ).style(grid=[2], height="auto")], enable_queue=True, title="CLIP Image Search",
|
131 |
+
# description="This application displays TOP THREE images from Unsplash dataset that best match the search query provided by the user. Moreover, the input can be provided via two modes ie text or image form.").launch()
|
132 |
|