import gradio as gr import whisper import tempfile import os model = whisper.load_model("base") def video_to_text(video_file): temp_dir = tempfile.mkdtemp() video_path = os.path.join(temp_dir, "input_video.mp4") with open(video_path, 'wb') as f: f.write(video_file.read()) transcription = model.transcribe(video_path) os.remove(video_path) return transcription['text'] iface = gr.Interface( fn=video_to_text, inputs=gr.File(file_types=["video"]), outputs="text", title="Video to Text Transcription", description="Upload a video and get the transcribed text" ) iface.launch()