Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import subprocess | |
| import uuid | |
| import os | |
| 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 | |
| iface = gr.Interface( | |
| fn=convert_video, | |
| inputs=gr.File(file_types=[".webm"], label="Upload WebM"), | |
| outputs=gr.File(label="MP4 Output"), | |
| title="WebM → MP4 Converter", | |
| api_name="convert" # 🔥 AGORA É API DE VERDADE | |
| ) | |
| iface.queue() | |
| iface.launch() | |