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() |