Spaces:
Running
Running
Jhjoon05
commited on
Commit
Β·
036b97d
1
Parent(s):
48a3041
added change() to dropdown model for translation option
Browse files
app.py
CHANGED
|
@@ -11,6 +11,13 @@ def open_output_folder():
|
|
| 11 |
else:
|
| 12 |
print(f"The folder {folder_path} does not exist.")
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
whisper_inf = WhisperInference()
|
| 15 |
block = gr.Blocks(css=CSS).queue(api_open=False)
|
| 16 |
|
|
@@ -36,6 +43,7 @@ with block:
|
|
| 36 |
|
| 37 |
btn_run.click(fn=whisper_inf.transcribe_file,inputs=[input_file,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 38 |
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
|
|
|
| 39 |
|
| 40 |
with gr.TabItem("Youtube"): # tab2
|
| 41 |
with gr.Row():
|
|
@@ -61,6 +69,7 @@ with block:
|
|
| 61 |
btn_run.click(fn=whisper_inf.transcribe_youtube,inputs=[tb_youtubelink,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 62 |
tb_youtubelink.change(get_ytmetas,inputs=[tb_youtubelink],outputs=[img_thumbnail,tb_title,tb_description])
|
| 63 |
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
|
|
|
| 64 |
|
| 65 |
with gr.TabItem("Mic"): # tab3
|
| 66 |
with gr.Row():
|
|
@@ -78,7 +87,8 @@ with block:
|
|
| 78 |
btn_openfolder = gr.Button('π').style(full_width=False)
|
| 79 |
|
| 80 |
btn_run.click(fn=whisper_inf.transcribe_mic,inputs=[mic_input,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 81 |
-
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
|
|
|
| 82 |
|
| 83 |
block.launch()
|
| 84 |
|
|
|
|
| 11 |
else:
|
| 12 |
print(f"The folder {folder_path} does not exist.")
|
| 13 |
|
| 14 |
+
def on_change_models(model_size):
|
| 15 |
+
translatable_model = ["large","large-v1","large-v2"]
|
| 16 |
+
if model_size not in translatable_model:
|
| 17 |
+
return gr.Checkbox.update(visible=False,value=False,interactive=False)
|
| 18 |
+
else:
|
| 19 |
+
return gr.Checkbox.update(visible=True,value=False,label="Translate to English?",interactive=True)
|
| 20 |
+
|
| 21 |
whisper_inf = WhisperInference()
|
| 22 |
block = gr.Blocks(css=CSS).queue(api_open=False)
|
| 23 |
|
|
|
|
| 43 |
|
| 44 |
btn_run.click(fn=whisper_inf.transcribe_file,inputs=[input_file,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 45 |
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
| 46 |
+
dd_model.change(fn=on_change_models,inputs=[dd_model],outputs=[cb_translate])
|
| 47 |
|
| 48 |
with gr.TabItem("Youtube"): # tab2
|
| 49 |
with gr.Row():
|
|
|
|
| 69 |
btn_run.click(fn=whisper_inf.transcribe_youtube,inputs=[tb_youtubelink,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 70 |
tb_youtubelink.change(get_ytmetas,inputs=[tb_youtubelink],outputs=[img_thumbnail,tb_title,tb_description])
|
| 71 |
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
| 72 |
+
dd_model.change(fn=on_change_models,inputs=[dd_model],outputs=[cb_translate])
|
| 73 |
|
| 74 |
with gr.TabItem("Mic"): # tab3
|
| 75 |
with gr.Row():
|
|
|
|
| 87 |
btn_openfolder = gr.Button('π').style(full_width=False)
|
| 88 |
|
| 89 |
btn_run.click(fn=whisper_inf.transcribe_mic,inputs=[mic_input,dd_model,dd_lang,dd_subformat,cb_translate],outputs=[tb_indicator])
|
| 90 |
+
btn_openfolder.click(fn=open_output_folder,inputs=[],outputs=[])
|
| 91 |
+
dd_model.change(fn=on_change_models,inputs=[dd_model],outputs=[cb_translate])
|
| 92 |
|
| 93 |
block.launch()
|
| 94 |
|