Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
**/.pytest_cache/
**/venv/
**/__pycache__/
**/.gradio/
outputs/
models/
modules/yt_tmp.wav
Expand Down
25 changes: 18 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def launch(self):
params = [input_file, tb_input_folder, dd_file_format, cb_timestamp]
btn_run.click(fn=self.whisper_inf.transcribe_file,
inputs=params + pipeline_params,
outputs=[tb_indicator, files_subtitles])
outputs=[tb_indicator, files_subtitles],
trigger_mode="multiple")
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)

with gr.TabItem(_("Youtube")): # tab2
Expand Down Expand Up @@ -155,7 +156,8 @@ def launch(self):
inputs=params + pipeline_params,
outputs=[tb_indicator, files_subtitles])
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
outputs=[img_thumbnail, tb_title, tb_description])
outputs=[img_thumbnail, tb_title, tb_description],
trigger_mode="multiple")
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)

with gr.TabItem(_("Mic")): # tab3
Expand All @@ -175,7 +177,8 @@ def launch(self):

btn_run.click(fn=self.whisper_inf.transcribe_mic,
inputs=params + pipeline_params,
outputs=[tb_indicator, files_subtitles])
outputs=[tb_indicator, files_subtitles],
trigger_mode="multiple")
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)

with gr.TabItem(_("T2T Translation")): # tab 4
Expand Down Expand Up @@ -210,7 +213,8 @@ def launch(self):
btn_run.click(fn=self.deepl_api.translate_deepl,
inputs=[tb_api_key, file_subs, dd_source_lang, dd_target_lang,
cb_is_pro, cb_timestamp],
outputs=[tb_indicator, files_subtitles])
outputs=[tb_indicator, files_subtitles],
trigger_mode="multiple")

btn_openfolder.click(
fn=lambda: self.open_folder(os.path.join(self.args.output_dir, "translations")),
Expand Down Expand Up @@ -246,7 +250,8 @@ def launch(self):
btn_run.click(fn=self.nllb_inf.translate_file,
inputs=[file_subs, dd_model_size, dd_source_lang, dd_target_lang,
nb_max_length, cb_timestamp],
outputs=[tb_indicator, files_subtitles])
outputs=[tb_indicator, files_subtitles],
trigger_mode="multiple")

btn_openfolder.click(
fn=lambda: self.open_folder(os.path.join(self.args.output_dir, "translations")),
Expand Down Expand Up @@ -275,7 +280,8 @@ def launch(self):
btn_run.click(fn=self.whisper_inf.music_separator.separate_files,
inputs=[files_audio, dd_uvr_model_size, dd_uvr_device, nb_uvr_segment_size,
cb_uvr_save_file],
outputs=[ad_instrumental, ad_vocals])
outputs=[ad_instrumental, ad_vocals],
trigger_mode="multiple")
btn_open_instrumental_folder.click(inputs=None,
outputs=None,
fn=lambda: self.open_folder(os.path.join(
Expand All @@ -290,7 +296,9 @@ def launch(self):
# Launch the app with optional gradio settings
args = self.args
self.app.queue(
api_open=args.api_open
api_open=args.api_open,
default_concurrency_limit=args.default_concurrency_limit,
max_size=args.max_size
).launch(
share=args.share,
server_name=args.server_name,
Expand Down Expand Up @@ -325,6 +333,9 @@ def open_folder(folder_path: str):
parser.add_argument('--username', type=str, default=None, help='Gradio authentication username')
parser.add_argument('--password', type=str, default=None, help='Gradio authentication password')
parser.add_argument('--theme', type=str, default=None, help='Gradio Blocks theme')
parser.add_argument('--default_concurrency_limit', type=int, default=None, help='Default concurrency limit of the '
'queue in the gradio app')
parser.add_argument('--max_size', type=int, default=None, help='Max size of the queue in the gradio app')
parser.add_argument('--colab', type=str2bool, default=False, nargs='?', const=True, help='Is colab user or not')
parser.add_argument('--api_open', type=str2bool, default=False, nargs='?', const=True,
help='Enable api or not in Gradio')
Expand Down
Loading