Lenylvt commited on
Commit
fc9312a
·
verified ·
1 Parent(s): 2a6b090

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -40,17 +40,19 @@ def video_demo(video, subtitle, subtitle_type, subtitle_language):
40
  else:
41
  return video
42
 
43
- demo = gr.Interface(
44
- fn=video_demo,
45
- gr.Markdown("# Text to SRT Converter"),
46
- gr.Markdown("### ⚠️ For information, the process can be really long."),
47
- inputs=[
48
- gr.Video(label="Video", interactive=True),
49
- gr.File(label="Subtitle", file_types=[".srt", ".vtt"]),
50
- gr.Textbox(label="Subtitle Language (ISO 639-1 code, 'en' for English)"),
51
- ],
52
- outputs=gr.Video(label="Processed Video"),
53
- )
 
 
54
 
55
  if __name__ == "__main__":
56
  demo.launch()
 
40
  else:
41
  return video
42
 
43
+ with gr.Blocks() as demo:
44
+ gr.Markdown("# Text to SRT Converter")
45
+ gr.Markdown("### ⚠️ For information, the process can be really long.")
46
+
47
+ with gr.Group():
48
+ video_input = gr.Video(label="Video", interactive=True)
49
+ subtitle_input = gr.File(label="Subtitle", file_types=[".srt", ".vtt"])
50
+ subtitle_language_input = gr.Textbox(label="Subtitle Language (ISO 639-1 code, 'en' for English)")
51
+ submit_button = gr.Button("Submit")
52
+
53
+ output_video = gr.Video(label="Processed Video")
54
+
55
+ submit_button.click(fn=video_demo, inputs=[video_input, subtitle_input, subtitle_language_input], outputs=output_video)
56
 
57
  if __name__ == "__main__":
58
  demo.launch()