Update app.py
Browse files
app.py
CHANGED
|
@@ -319,6 +319,34 @@ class App:
|
|
| 319 |
with gr.Column():
|
| 320 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
| 321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
# Launch the app with optional gradio settings
|
| 323 |
args = self.args
|
| 324 |
|
|
|
|
| 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 |
|