Spaces:
Sleeping
Sleeping
Commit
·
eb84e41
1
Parent(s):
f782fff
chore: Refactor app.py for improved code organization and readability
Browse files
app.py
CHANGED
@@ -138,28 +138,38 @@ h1 {
|
|
138 |
}
|
139 |
"""
|
140 |
|
141 |
-
demo
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
)
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
|
|
164 |
if __name__ == "__main__":
|
165 |
demo.launch()
|
|
|
138 |
}
|
139 |
"""
|
140 |
|
141 |
+
# Replace the demo definition with this Blocks implementation
|
142 |
+
with gr.Blocks(css=css, theme=geocities90s) as demo:
|
143 |
+
gr.HTML("<h1>🛸 Top Secret UFO Document Search 🛸</h1>")
|
144 |
+
gr.HTML(
|
145 |
+
"<marquee direction='left' scrollamount='5' class='yellow-text'>Uncover the truth that's out there! The government doesn't want you to know!</marquee>"
|
146 |
+
)
|
147 |
+
|
148 |
+
with gr.Row():
|
149 |
+
with gr.Column(scale=3):
|
150 |
+
query_input = gr.Textbox(
|
151 |
+
label="Enter your cosmic query",
|
152 |
+
placeholder="e.g., alien abduction, crop circles",
|
153 |
+
)
|
154 |
+
with gr.Column(scale=1):
|
155 |
+
num_results = gr.Slider(
|
156 |
+
minimum=1,
|
157 |
+
maximum=10,
|
158 |
+
step=1,
|
159 |
+
label="Number of classified documents",
|
160 |
+
value=5,
|
161 |
+
)
|
162 |
+
|
163 |
+
search_button = gr.Button("Declassify Documents")
|
164 |
+
|
165 |
+
gallery_output = gr.Gallery(label="Declassified UFO Sightings", elem_id="gallery")
|
166 |
+
|
167 |
+
search_button.click(
|
168 |
+
fn=search_by_text_and_return_images,
|
169 |
+
inputs=[query_input, num_results],
|
170 |
+
outputs=gallery_output,
|
171 |
+
)
|
172 |
|
173 |
+
# Keep the main block
|
174 |
if __name__ == "__main__":
|
175 |
demo.launch()
|