|
import gradio as gr |
|
from src.video_processor.processor import VideoAnalyzer |
|
import logging |
|
|
|
logging.basicConfig(level=logging.INFO) |
|
logger = logging.getLogger(__name__) |
|
|
|
def process_video(video_path): |
|
try: |
|
analyzer = VideoAnalyzer() |
|
result = analyzer.process_video(video_path) |
|
return result[0]["description"] |
|
except Exception as e: |
|
logger.error(f"Error processing video: {str(e)}", exc_info=True) |
|
return f"Error processing video: {str(e)}" |
|
|
|
|
|
demo = gr.Interface( |
|
fn=process_video, |
|
inputs=gr.Video(label="Upload your video"), |
|
outputs=gr.Textbox(label="Video Analysis", lines=10), |
|
title="Video Analysis with SmolVLM", |
|
description="Upload a video to get a detailed analysis of its content, including actions, events, timestamps, and important details.", |
|
examples=[], |
|
cache_examples=False |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |