jhj0517 commited on
Commit
cff2a72
1 Parent(s): f7d7f08

refactored open_folder()

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -5,8 +5,7 @@ from ui.htmls import CSS, MARKDOWN
5
  from modules.youtube_manager import get_ytmetas
6
 
7
 
8
- def open_output_folder():
9
- folder_path = "outputs"
10
  if os.path.exists(folder_path):
11
  os.system(f"start {folder_path}")
12
  else:
@@ -47,7 +46,7 @@ with block:
47
 
48
  btn_run.click(fn=whisper_inf.transcribe_file,
49
  inputs=[input_file, dd_model, dd_lang, dd_subformat, cb_translate], outputs=[tb_indicator])
50
- btn_openfolder.click(fn=open_output_folder, inputs=[], outputs=[])
51
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
52
 
53
  with gr.TabItem("Youtube"): # tab2
@@ -77,7 +76,7 @@ with block:
77
  outputs=[tb_indicator])
78
  tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
79
  outputs=[img_thumbnail, tb_title, tb_description])
80
- btn_openfolder.click(fn=open_output_folder, inputs=[], outputs=[])
81
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
82
 
83
  with gr.TabItem("Mic"): # tab3
@@ -98,7 +97,7 @@ with block:
98
 
99
  btn_run.click(fn=whisper_inf.transcribe_mic,
100
  inputs=[mic_input, dd_model, dd_lang, dd_subformat, cb_translate], outputs=[tb_indicator])
101
- btn_openfolder.click(fn=open_output_folder, inputs=[], outputs=[])
102
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
103
 
104
  block.launch()
 
5
  from modules.youtube_manager import get_ytmetas
6
 
7
 
8
+ def open_fodler(folder_path):
 
9
  if os.path.exists(folder_path):
10
  os.system(f"start {folder_path}")
11
  else:
 
46
 
47
  btn_run.click(fn=whisper_inf.transcribe_file,
48
  inputs=[input_file, dd_model, dd_lang, dd_subformat, cb_translate], outputs=[tb_indicator])
49
+ btn_openfolder.click(fn=lambda: open_fodler("outputs"), inputs=None, outputs=None)
50
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
51
 
52
  with gr.TabItem("Youtube"): # tab2
 
76
  outputs=[tb_indicator])
77
  tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
78
  outputs=[img_thumbnail, tb_title, tb_description])
79
+ btn_openfolder.click(fn=lambda: open_fodler("outputs"), inputs=None, outputs=None)
80
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
81
 
82
  with gr.TabItem("Mic"): # tab3
 
97
 
98
  btn_run.click(fn=whisper_inf.transcribe_mic,
99
  inputs=[mic_input, dd_model, dd_lang, dd_subformat, cb_translate], outputs=[tb_indicator])
100
+ btn_openfolder.click(fn=lambda: open_fodler("outputs"), inputs=None, outputs=None)
101
  dd_model.change(fn=on_change_models, inputs=[dd_model], outputs=[cb_translate])
102
 
103
  block.launch()