Spaces:
Sleeping
Sleeping
File size: 862 Bytes
d134fe0 f3fc091 d134fe0 f3fc091 d134fe0 7a1ef03 |
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 |
import gradio as gr
from inference import main
import tempfile
from moviepy.editor import VideoFileClip
def remove_audio_then_infer(video_path):
# Load video and remove audio
clip = VideoFileClip(video_path)
clip_no_audio = clip.without_audio()
# Save to a temporary file
temp_video = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False)
clip_no_audio.write_videofile(temp_video.name, codec="libx264", audio=False, logger=None)
# Run your main inference
return main(temp_video.name)
iface = gr.Interface(
fn=remove_audio_then_infer,
inputs=gr.Video(label="Upload Cricket Video"),
outputs=gr.Video(label="Generated Commentary Video"),
title="Cricket Commentary Generator",
description="Upload a cricket video to generate AI-powered commentary with ambient sound."
)
iface.launch(debug=True, share=True) |