Spaces:
Runtime error
Runtime error
File size: 805 Bytes
af1695b 33c4afa 69005d5 a950c39 af1695b 37d5502 33c4afa 69005d5 ad45296 a950c39 ad45296 b73788f a950c39 ad45296 b73788f e7a363a a950c39 a8edf22 | 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 | import gradio as gr
import subprocess
import tempfile
import os
def convert_webm_to_mp4(webm_file):
if webm_file is None:
return None
tmp_dir = tempfile.mkdtemp()
mp4_path = os.path.join(tmp_dir, "output.mp4")
subprocess.run(
["ffmpeg", "-y", "-i", webm_file, "-c:v", "libx264", mp4_path],
check=True
)
return mp4_path
# --- Interface Gradio compatível com App Builder ---
iface = gr.Interface(
fn=convert_webm_to_mp4,
inputs=gr.Video(label="Upload WebM"),
outputs=gr.File(label="Download MP4"),
)
if __name__ == "__main__":
# O cors_allowed_origins=["*"] libera o acesso para qualquer site (incluindo este preview)
iface.launch(
server_name="0.0.0.0",
server_port=7860,
cors_allowed_origins=["*"]
) |