Spaces:
Runtime error
Runtime error
File size: 879 Bytes
af1695b 33c4afa af1695b 1c02b32 af1695b 33c4afa af1695b 33c4afa 1c02b32 33c4afa 1c02b32 33c4afa af1695b 1c02b32 33c4afa af1695b 33c4afa 1c02b32 33c4afa 1c02b32 33c4afa | 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import gradio as gr
import subprocess
import os
import uuid
def convert_video(webm_file):
if webm_file is None:
return None
output_path = f"/tmp/{uuid.uuid4()}.mp4"
subprocess.run([
"ffmpeg", "-y",
"-i", webm_file,
"-movflags", "faststart",
"-pix_fmt", "yuv420p",
output_path
], check=True)
return output_path
with gr.Blocks() as demo:
gr.Markdown("## WebM → MP4 Converter")
video_input = gr.File(
label="Upload WebM",
file_types=[".webm"]
)
video_output = gr.File(
label="MP4 Output"
)
convert_btn = gr.Button("Convert")
convert_btn.click(
fn=convert_video,
inputs=video_input,
outputs=video_output,
api_name="convert" # 🔥 ISSO É O QUE ESTAVA FALTANDO
)
demo.queue() # 🔥 OBRIGATÓRIO
demo.launch()
|