innoai commited on
Commit
389adfe
·
verified ·
1 Parent(s): d055e18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,9 +5,11 @@ import subprocess
5
  import gradio as gr
6
  import tempfile
7
 
8
- # Define supported subtitle formats
9
  SUPPORTED_SUBTITLE_FORMATS = ['srt', 'vtt', 'ass', 'ssa']
10
  SUPPORTED_SUBTITLE_FORMATS2 = ['srt', 'vtt', 'ass', 'ssa']
 
 
11
 
12
  def convert_subtitle_file(src_format, dest_format, input_file_path):
13
  """
@@ -126,7 +128,7 @@ def main():
126
  with gr.Row():
127
  # Left column: file upload and format selection
128
  with gr.Column(scale=1):
129
- file_input = gr.File(label="Upload Subtitle File", file_types=SUPPORTED_SUBTITLE_FORMATS, type="filepath")
130
  dest_format = gr.Dropdown(label='Convert To', choices=SUPPORTED_SUBTITLE_FORMATS2, value=SUPPORTED_SUBTITLE_FORMATS2[0])
131
  convert_button = gr.Button("Convert", elem_id="convert-btn")
132
  # Right column: display conversion result and error messages
 
5
  import gradio as gr
6
  import tempfile
7
 
8
+ # Define supported subtitle formats (without the dot for conversion logic)
9
  SUPPORTED_SUBTITLE_FORMATS = ['srt', 'vtt', 'ass', 'ssa']
10
  SUPPORTED_SUBTITLE_FORMATS2 = ['srt', 'vtt', 'ass', 'ssa']
11
+ # Define allowed file extensions for Gradio file uploader (with dot)
12
+ ALLOWED_EXTENSIONS = [".srt", ".vtt", ".ass", ".ssa"]
13
 
14
  def convert_subtitle_file(src_format, dest_format, input_file_path):
15
  """
 
128
  with gr.Row():
129
  # Left column: file upload and format selection
130
  with gr.Column(scale=1):
131
+ file_input = gr.File(label="Upload Subtitle File", file_types=ALLOWED_EXTENSIONS, type="filepath")
132
  dest_format = gr.Dropdown(label='Convert To', choices=SUPPORTED_SUBTITLE_FORMATS2, value=SUPPORTED_SUBTITLE_FORMATS2[0])
133
  convert_button = gr.Button("Convert", elem_id="convert-btn")
134
  # Right column: display conversion result and error messages