Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,13 +70,14 @@ def chat_interaction(video_path, chatbot, user_message):
|
|
| 70 |
return "", chatbot
|
| 71 |
|
| 72 |
# Define Gradio interface
|
| 73 |
-
|
|
|
|
|
|
|
| 74 |
|
| 75 |
# Railway defect analysis tab
|
| 76 |
with gr.Blocks() as railway_tab:
|
| 77 |
with gr.Column():
|
| 78 |
gr.Markdown("### Railway Defect Analysis")
|
| 79 |
-
railway_video_input = video_input.render()
|
| 80 |
defect_analysis_output = gr.Textbox(label="Defect Analysis")
|
| 81 |
analyze_button = gr.Button("Analyze for Railway Defects")
|
| 82 |
analyze_button.click(fn=railway_defect_analysis, inputs=railway_video_input, outputs=defect_analysis_output)
|
|
@@ -85,7 +86,6 @@ with gr.Blocks() as railway_tab:
|
|
| 85 |
with gr.Blocks() as chat_tab:
|
| 86 |
with gr.Column():
|
| 87 |
gr.Markdown("### Interactive Chat Mode")
|
| 88 |
-
chat_video_input = video_input.render()
|
| 89 |
chatbot = gr.Chatbot(label="Video Analysis Chatbot")
|
| 90 |
user_input = gr.Textbox(label="Ask something specific about the video", placeholder="E.g., Are there any cars in this video?")
|
| 91 |
user_input.submit(fn=chat_interaction, inputs=[chat_video_input, chatbot, user_input], outputs=[user_input, chatbot])
|
|
|
|
| 70 |
return "", chatbot
|
| 71 |
|
| 72 |
# Define Gradio interface
|
| 73 |
+
# Separate video inputs for each tab to avoid the DuplicateBlockError
|
| 74 |
+
railway_video_input = gr.Video(label="Upload Video for Railway Analysis", autoplay=True)
|
| 75 |
+
chat_video_input = gr.Video(label="Upload Video for Chat Analysis", autoplay=True)
|
| 76 |
|
| 77 |
# Railway defect analysis tab
|
| 78 |
with gr.Blocks() as railway_tab:
|
| 79 |
with gr.Column():
|
| 80 |
gr.Markdown("### Railway Defect Analysis")
|
|
|
|
| 81 |
defect_analysis_output = gr.Textbox(label="Defect Analysis")
|
| 82 |
analyze_button = gr.Button("Analyze for Railway Defects")
|
| 83 |
analyze_button.click(fn=railway_defect_analysis, inputs=railway_video_input, outputs=defect_analysis_output)
|
|
|
|
| 86 |
with gr.Blocks() as chat_tab:
|
| 87 |
with gr.Column():
|
| 88 |
gr.Markdown("### Interactive Chat Mode")
|
|
|
|
| 89 |
chatbot = gr.Chatbot(label="Video Analysis Chatbot")
|
| 90 |
user_input = gr.Textbox(label="Ask something specific about the video", placeholder="E.g., Are there any cars in this video?")
|
| 91 |
user_input.submit(fn=chat_interaction, inputs=[chat_video_input, chatbot, user_input], outputs=[user_input, chatbot])
|