AlexandreScriptsMT commited on
Commit
32b1f1e
·
verified ·
1 Parent(s): 1d7e0ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -7,29 +7,25 @@ OUTPUT_DIR = "outputs"
7
  os.makedirs(OUTPUT_DIR, exist_ok=True)
8
 
9
  def webm_to_mp4(video):
10
- input_path = video
11
  output_name = f"{uuid.uuid4()}.mp4"
12
  output_path = os.path.join(OUTPUT_DIR, output_name)
13
 
14
- command = [
15
  "ffmpeg",
16
  "-y",
17
- "-i", input_path,
18
  "-movflags", "faststart",
19
  "-pix_fmt", "yuv420p",
20
  output_path
21
- ]
22
-
23
- subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
24
 
25
  return output_path
26
 
27
- iface = gr.Interface(
28
  fn=webm_to_mp4,
29
- inputs=gr.Video(format="webm"),
30
- outputs=gr.File(label="Download MP4"),
31
- title="WebM → MP4 Converter",
32
- description="Envie um vídeo WebM e receba um MP4 pronto para download."
33
  )
34
 
35
- iface.launch()
 
7
  os.makedirs(OUTPUT_DIR, exist_ok=True)
8
 
9
  def webm_to_mp4(video):
 
10
  output_name = f"{uuid.uuid4()}.mp4"
11
  output_path = os.path.join(OUTPUT_DIR, output_name)
12
 
13
+ subprocess.run([
14
  "ffmpeg",
15
  "-y",
16
+ "-i", video,
17
  "-movflags", "faststart",
18
  "-pix_fmt", "yuv420p",
19
  output_path
20
+ ], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
 
 
21
 
22
  return output_path
23
 
24
+ app = gr.Interface(
25
  fn=webm_to_mp4,
26
+ inputs=gr.File(file_types=[".webm"]),
27
+ outputs=gr.File(),
28
+ api_name="convert"
 
29
  )
30
 
31
+ app.launch()