Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,12 @@ class App:
|
|
102 |
cb_timestamp = gr.Checkbox(value=whisper_params["add_timestamp"], label="Add timestamp to output file",interactive=True, visible=True)
|
103 |
#dd_file_format = gr.Dropdown(choices=["SRT", "WebVTT", "txt"], value="SRT", label="File Format")
|
104 |
dd_file_format = gr.Dropdown(choices=["TXT","SRT"], value="TXT", label="Output format", visible=False, info="Output preview format")
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
106 |
# with gr.Accordion("Speaker diarization", open=False, visible=True):
|
107 |
# cb_diarize = gr.Checkbox(value=diarization_params["is_diarize"], label="Use diarization",interactive=True)
|
108 |
# tb_hf_token = gr.Text(label="Token", value=diarization_params["hf_token"],info="Required to use diarization")
|
@@ -319,34 +324,6 @@ class App:
|
|
319 |
with gr.Column():
|
320 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
321 |
|
322 |
-
with gr.TabItem("Translation"): # tab3
|
323 |
-
with gr.Row():
|
324 |
-
file_subs = gr.Files(type="filepath", label="Upload Subtitle Files to translate here",file_types=['.vtt', '.srt'])
|
325 |
-
|
326 |
-
with gr.Row():
|
327 |
-
dd_model_size = gr.Dropdown(label="Model", value=nllb_params["model_size"],choices=self.nllb_inf.available_models)
|
328 |
-
dd_source_lang = gr.Dropdown(label="Source Language", value=nllb_params["source_lang"],choices=self.nllb_inf.available_source_langs)
|
329 |
-
dd_target_lang = gr.Dropdown(label="Target Language", value=nllb_params["target_lang"],choices=self.nllb_inf.available_target_langs)
|
330 |
-
with gr.Row():
|
331 |
-
nb_max_length = gr.Number(label="Max Length Per Line", value=nllb_params["max_length"],precision=0)
|
332 |
-
with gr.Row():
|
333 |
-
cb_timestamp = gr.Checkbox(value=translation_params["add_timestamp"], label="Add a timestamp to the end of the filename",interactive=True)
|
334 |
-
with gr.Row():
|
335 |
-
btn_run = gr.Button("TRANSLATE SUBTITLE FILE", variant="primary")
|
336 |
-
with gr.Row():
|
337 |
-
tb_indicator = gr.Textbox(label="Output", scale=5)
|
338 |
-
files_subtitles = gr.Files(label="Downloadable output file", scale=3)
|
339 |
-
btn_openfolder = gr.Button('📂', scale=1)
|
340 |
-
|
341 |
-
btn_run.click(fn=self.nllb_inf.translate_file,
|
342 |
-
inputs=[file_subs, dd_model_size, dd_source_lang, dd_target_lang,
|
343 |
-
nb_max_length, cb_timestamp],
|
344 |
-
outputs=[tb_indicator, files_subtitles])
|
345 |
-
|
346 |
-
btn_openfolder.click(fn=lambda: self.open_folder(os.path.join(self.args.output_dir, "translations")),
|
347 |
-
inputs=None,
|
348 |
-
outputs=None)
|
349 |
-
|
350 |
# Launch the app with optional gradio settings
|
351 |
args = self.args
|
352 |
|
|
|
102 |
cb_timestamp = gr.Checkbox(value=whisper_params["add_timestamp"], label="Add timestamp to output file",interactive=True, visible=True)
|
103 |
#dd_file_format = gr.Dropdown(choices=["SRT", "WebVTT", "txt"], value="SRT", label="File Format")
|
104 |
dd_file_format = gr.Dropdown(choices=["TXT","SRT"], value="TXT", label="Output format", visible=False, info="Output preview format")
|
105 |
+
|
106 |
+
dd_model_size = gr.Dropdown(label="Model", value=nllb_params["model_size"],choices=self.nllb_inf.available_models)
|
107 |
+
dd_source_lang = gr.Dropdown(label="Source Language", value=nllb_params["source_lang"],choices=self.nllb_inf.available_source_langs)
|
108 |
+
dd_target_lang = gr.Dropdown(label="Target Language", value=nllb_params["target_lang"],choices=self.nllb_inf.available_target_langs)
|
109 |
+
nb_max_length = gr.Number(label="Max Length Per Line", value=nllb_params["max_length"],precision=0)
|
110 |
+
|
111 |
# with gr.Accordion("Speaker diarization", open=False, visible=True):
|
112 |
# cb_diarize = gr.Checkbox(value=diarization_params["is_diarize"], label="Use diarization",interactive=True)
|
113 |
# tb_hf_token = gr.Text(label="Token", value=diarization_params["hf_token"],info="Required to use diarization")
|
|
|
324 |
with gr.Column():
|
325 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
# Launch the app with optional gradio settings
|
328 |
args = self.args
|
329 |
|