Update app.py
Browse files
app.py
CHANGED
@@ -343,6 +343,7 @@ class App:
|
|
343 |
with gr.Column(scale=1):
|
344 |
tb_info = gr.Textbox(label="Output info", interactive=False, show_copy_button=True)
|
345 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
|
|
346 |
# btn_openfolder = gr.Button('📂', scale=1)
|
347 |
|
348 |
params = [input_file_audio, input_file_video, input_file_multi, input_multi, tb_input_folder, dd_file_format, cb_timestamp_file, cb_translate_output, dd_translate_model, dd_target_lang, cb_timestamp_preview]
|
@@ -353,7 +354,8 @@ class App:
|
|
353 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
354 |
|
355 |
input_multi.change(fn=self.update_viewer,inputs=input_multi,outputs=[input_file_audio,input_file_video,input_file_multi])
|
356 |
-
|
|
|
357 |
with gr.TabItem("Device info"): # tab2
|
358 |
with gr.Column():
|
359 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
@@ -398,6 +400,11 @@ class App:
|
|
398 |
else:
|
399 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
400 |
|
|
|
|
|
|
|
|
|
|
|
401 |
# Create the parser for command-line arguments
|
402 |
parser = argparse.ArgumentParser()
|
403 |
parser.add_argument('--whisper_type', type=str, default="faster-whisper",
|
|
|
343 |
with gr.Column(scale=1):
|
344 |
tb_info = gr.Textbox(label="Output info", interactive=False, show_copy_button=True)
|
345 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
346 |
+
btn_download = gr.Button("Download result")
|
347 |
# btn_openfolder = gr.Button('📂', scale=1)
|
348 |
|
349 |
params = [input_file_audio, input_file_video, input_file_multi, input_multi, tb_input_folder, dd_file_format, cb_timestamp_file, cb_translate_output, dd_translate_model, dd_target_lang, cb_timestamp_preview]
|
|
|
354 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
355 |
|
356 |
input_multi.change(fn=self.update_viewer,inputs=input_multi,outputs=[input_file_audio,input_file_video,input_file_multi])
|
357 |
+
btn_download.click(fn=download_files,inputs=files_subtitles,outputs=gr.File())
|
358 |
+
|
359 |
with gr.TabItem("Device info"): # tab2
|
360 |
with gr.Column():
|
361 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
|
|
400 |
else:
|
401 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
402 |
|
403 |
+
@staticmethod
|
404 |
+
def download_files(file_paths):
|
405 |
+
valid_files = [file for file in file_paths if os.path.exists(file)]
|
406 |
+
return valid_files
|
407 |
+
|
408 |
# Create the parser for command-line arguments
|
409 |
parser = argparse.ArgumentParser()
|
410 |
parser.add_argument('--whisper_type', type=str, default="faster-whisper",
|