File size: 880 Bytes
5f42812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
from video_processor.processor import VideoAnalyzer
import logging

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

analyzer = VideoAnalyzer()

def process_video(video_path):
    """Process video and return description"""
    try:
        logger.info(f"Processing video: {video_path}")
        results = analyzer.process_video(video_path)
        return results[0]["description"]
    except Exception as e:
        logger.error(f"Error processing video: {e}")
        return str(e)

# Create Gradio interface
demo = gr.Interface(
    fn=process_video,
    inputs=gr.Video(label="Upload Video"),
    outputs=gr.Textbox(label="Video Description"),
    title="SmolVLM Video Analyzer",
    description="Upload a video to get a detailed description of its contents."
)

if __name__ == "__main__":
    demo.launch()