Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,20 @@ class GalleryUI:
|
|
102 |
|
103 |
def create_interface(self) -> gr.Blocks:
|
104 |
"""Create the Gradio interface."""
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
with gr.Column(elem_classes="container"):
|
107 |
self._create_header()
|
108 |
self._create_search_section()
|
@@ -116,23 +129,29 @@ class GalleryUI:
|
|
116 |
with gr.Column(elem_classes="header"):
|
117 |
gr.Markdown("# Gallery Search")
|
118 |
gr.Markdown("Search through your collection of photos with AI")
|
|
|
|
|
119 |
|
120 |
def _create_search_section(self) -> None:
|
121 |
"""Create the search interface section."""
|
122 |
with gr.Column():
|
123 |
self.query_text = gr.Textbox(
|
124 |
-
placeholder="Example: Riding my horse",
|
125 |
label="Search Query",
|
126 |
elem_classes="search-input",
|
127 |
autofocus=True,
|
128 |
container=False,
|
129 |
interactive=True
|
130 |
)
|
131 |
-
|
|
|
|
|
132 |
self.gallery = gr.Gallery(
|
133 |
label="Search Results",
|
134 |
-
columns=
|
135 |
-
|
|
|
|
|
136 |
object_fit="cover",
|
137 |
elem_classes="gallery",
|
138 |
container=False,
|
@@ -156,7 +175,6 @@ class GalleryUI:
|
|
156 |
)
|
157 |
|
158 |
|
159 |
-
|
160 |
search_engine = ImageSearchEngine(
|
161 |
model_name = "sentence-transformers/all-MiniLM-L6-v2",
|
162 |
output_dim = 64,
|
|
|
102 |
|
103 |
def create_interface(self) -> gr.Blocks:
|
104 |
"""Create the Gradio interface."""
|
105 |
+
custom_theme = gr.themes.Soft(
|
106 |
+
text_size='lg',
|
107 |
+
primary_hue="purple",
|
108 |
+
secondary_hue="gray",
|
109 |
+
font=[gr.themes.GoogleFont("Inter"), "system-ui", "sans-serif"],
|
110 |
+
font_mono=["IBM Plex Mono", "monospace"]
|
111 |
+
).set(
|
112 |
+
button_primary_background_fill="*primary_300",
|
113 |
+
button_primary_background_fill_hover="*primary_200",
|
114 |
+
block_shadow="*shadow_drop_lg",
|
115 |
+
block_border_width="2px"
|
116 |
+
)
|
117 |
+
# with gr.Blocks(css=self.load_css(), theme=gr.themes.Soft(text_size='lg')) as demo:
|
118 |
+
with gr.Blocks(css=self.load_css(), theme=custom_theme) as demo:
|
119 |
with gr.Column(elem_classes="container"):
|
120 |
self._create_header()
|
121 |
self._create_search_section()
|
|
|
129 |
with gr.Column(elem_classes="header"):
|
130 |
gr.Markdown("# Gallery Search")
|
131 |
gr.Markdown("Search through your collection of photos with AI")
|
132 |
+
gr.Markdown("`in this demo, you are searching COCO dataset images`")
|
133 |
+
|
134 |
|
135 |
def _create_search_section(self) -> None:
|
136 |
"""Create the search interface section."""
|
137 |
with gr.Column():
|
138 |
self.query_text = gr.Textbox(
|
139 |
+
placeholder="Example: Riding my horse [Enter]",
|
140 |
label="Search Query",
|
141 |
elem_classes="search-input",
|
142 |
autofocus=True,
|
143 |
container=False,
|
144 |
interactive=True
|
145 |
)
|
146 |
+
|
147 |
+
with gr.Column(elem_classes="gallery"):
|
148 |
+
|
149 |
self.gallery = gr.Gallery(
|
150 |
label="Search Results",
|
151 |
+
columns=6,
|
152 |
+
# min_height=800,
|
153 |
+
# rows=3,
|
154 |
+
# height=800,
|
155 |
object_fit="cover",
|
156 |
elem_classes="gallery",
|
157 |
container=False,
|
|
|
175 |
)
|
176 |
|
177 |
|
|
|
178 |
search_engine = ImageSearchEngine(
|
179 |
model_name = "sentence-transformers/all-MiniLM-L6-v2",
|
180 |
output_dim = 64,
|