Spaces:
Runtime error
Runtime error
ss
Browse files
app.py
CHANGED
@@ -2,11 +2,10 @@ import gradio as gr
|
|
2 |
import subprocess
|
3 |
import os
|
4 |
|
5 |
-
|
6 |
def combine_video_subtitle(video_file, subtitle_file):
|
7 |
# Output video file name
|
8 |
output_file = "output_combined.mp4"
|
9 |
-
|
10 |
# Run ffmpeg command to combine video and subtitle
|
11 |
cmd = [
|
12 |
"ffmpeg",
|
@@ -20,12 +19,11 @@ def combine_video_subtitle(video_file, subtitle_file):
|
|
20 |
"-map", "1",
|
21 |
output_file
|
22 |
]
|
23 |
-
|
24 |
subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
25 |
-
|
26 |
return output_file
|
27 |
|
28 |
-
|
29 |
# Create Gradio interface
|
30 |
inputs = [
|
31 |
gr.inputs.File(label="Video File"),
|
@@ -40,4 +38,4 @@ description = "Combine a video file and a subtitle file using ffmpeg."
|
|
40 |
iface = gr.Interface(fn=combine_video_subtitle, inputs=inputs, outputs=outputs, title=title, description=description)
|
41 |
|
42 |
# Launch the Gradio interface
|
43 |
-
iface.launch()
|
|
|
2 |
import subprocess
|
3 |
import os
|
4 |
|
|
|
5 |
def combine_video_subtitle(video_file, subtitle_file):
|
6 |
# Output video file name
|
7 |
output_file = "output_combined.mp4"
|
8 |
+
|
9 |
# Run ffmpeg command to combine video and subtitle
|
10 |
cmd = [
|
11 |
"ffmpeg",
|
|
|
19 |
"-map", "1",
|
20 |
output_file
|
21 |
]
|
22 |
+
|
23 |
subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
24 |
+
|
25 |
return output_file
|
26 |
|
|
|
27 |
# Create Gradio interface
|
28 |
inputs = [
|
29 |
gr.inputs.File(label="Video File"),
|
|
|
38 |
iface = gr.Interface(fn=combine_video_subtitle, inputs=inputs, outputs=outputs, title=title, description=description)
|
39 |
|
40 |
# Launch the Gradio interface
|
41 |
+
iface.launch()
|