Spaces:
Sleeping
Sleeping
Refactor: Remove broken and duplicate UI components from app.py
Browse files
app.py
CHANGED
@@ -134,50 +134,5 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
134 |
outputs=[topic_status_text, topic_json_output]
|
135 |
)
|
136 |
|
137 |
-
# Set environment variables in your Hugging Face Space settings, not here.
|
138 |
-
# BACKEND_VIDEO_URL = "https://your-modal-or-backend-url/process_video_analysis"
|
139 |
-
# BACKEND_TOPIC_URL = "https://your-modal-or-backend-url/analyze_topic"
|
140 |
-
|
141 |
-
with gr.Tab("Demo (for Manual Testing)"):
|
142 |
-
gr.Markdown("### Manually test video URLs or paths for interpretation and observe the JSON response.")
|
143 |
-
demo_interface.render()
|
144 |
-
|
145 |
-
with gr.Tab("Topic Video Analysis"):
|
146 |
-
gr.Markdown("### Analyze Multiple Videos Based on a Topic")
|
147 |
-
gr.Markdown("Enter a topic, and the system will search for relevant videos, analyze them, and provide an aggregated JSON output.")
|
148 |
-
|
149 |
-
with gr.Row():
|
150 |
-
topic_input = gr.Textbox(label="Enter Topic", placeholder="e.g., 'best cat videos', 'Python programming tutorials'", scale=3)
|
151 |
-
max_videos_input = gr.Number(label="Max Videos to Analyze", value=3, minimum=1, maximum=5, step=1, scale=1)
|
152 |
-
|
153 |
-
topic_analysis_output = gr.JSON(label="Topic Analysis Results")
|
154 |
-
|
155 |
-
with gr.Row():
|
156 |
-
topic_submit_button = gr.Button("Analyze Topic Videos", variant="primary")
|
157 |
-
topic_clear_button = gr.Button("Clear")
|
158 |
-
|
159 |
-
topic_submit_button.click(
|
160 |
-
fn=call_topic_analysis_endpoint,
|
161 |
-
inputs=[topic_input, max_videos_input],
|
162 |
-
outputs=[topic_analysis_output]
|
163 |
-
)
|
164 |
-
|
165 |
-
def clear_topic_outputs():
|
166 |
-
return [None, 3, None]
|
167 |
-
topic_clear_button.click(fn=clear_topic_outputs, inputs=[], outputs=[topic_input, max_videos_input, topic_analysis_output])
|
168 |
-
|
169 |
-
gr.Examples(
|
170 |
-
examples=[
|
171 |
-
["AI in healthcare", 2],
|
172 |
-
["sustainable energy solutions", 3],
|
173 |
-
["how to make sourdough bread", 1]
|
174 |
-
],
|
175 |
-
inputs=[topic_input, max_videos_input],
|
176 |
-
outputs=topic_analysis_output,
|
177 |
-
fn=call_topic_analysis_endpoint,
|
178 |
-
cache_examples=False
|
179 |
-
)
|
180 |
-
gr.Markdown("**Note:** This process involves searching for videos and then analyzing each one. It can take a significant amount of time, especially for multiple videos. The backend has a long timeout, but please be patient.")
|
181 |
-
|
182 |
# Final launch of the Gradio app
|
183 |
demo.launch()
|
|
|
134 |
outputs=[topic_status_text, topic_json_output]
|
135 |
)
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
# Final launch of the Gradio app
|
138 |
demo.launch()
|