Spaces:
Running
Running
| import gradio as gr | |
| from utils.config import get_logger | |
| from utils.engine import process_and_index_video, ask_video_question | |
| logger = get_logger("GradioUI") | |
| logger.info("Constructing UI...") | |
| # Removed theme from Blocks constructor | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# 🧠 Multimodal Video RAG (Vision Q/A)") | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| video_input = gr.Video(label="Upload Video") | |
| index_btn = gr.Button("1. Process & Index Video", variant="primary") | |
| status_out = gr.Textbox(label="System Status", interactive=False) | |
| with gr.Column(scale=1): | |
| query_input = gr.Textbox(label="Ask a visual question:") | |
| ask_btn = gr.Button("2. Ask Question") | |
| answer_out = gr.Textbox(label="VLM Answer", lines=4) | |
| gallery_out = gr.Gallery(label="Context Frames", show_label=True, columns=3) | |
| index_btn.click(fn=process_and_index_video, inputs=[video_input], outputs=[status_out, gallery_out]) | |
| ask_btn.click(fn=ask_video_question, inputs=[query_input], outputs=[answer_out, gallery_out]) | |
| if __name__ == "__main__": | |
| logger.info("Launching server...") | |
| # Moved theme to launch method for Gradio 6.0 compatibility | |
| demo.launch(theme=gr.themes.Soft()) |