Spaces:
Running
Running
jhj0517
commited on
Commit
·
4df5628
1
Parent(s):
806824b
Rename function and variable
Browse files
app.py
CHANGED
|
@@ -44,7 +44,7 @@ class App:
|
|
| 44 |
print(f"Use \"{self.args.whisper_type}\" implementation\n"
|
| 45 |
f"Device \"{self.whisper_inf.device}\" is detected")
|
| 46 |
|
| 47 |
-
def
|
| 48 |
whisper_params = self.default_params["whisper"]
|
| 49 |
vad_params = self.default_params["vad"]
|
| 50 |
diarization_params = self.default_params["diarization"]
|
|
@@ -108,7 +108,7 @@ class App:
|
|
| 108 |
visible=self.args.colab,
|
| 109 |
value="")
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
with gr.Row():
|
| 114 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
@@ -119,7 +119,7 @@ class App:
|
|
| 119 |
|
| 120 |
params = [input_file, tb_input_folder, dd_file_format, cb_timestamp]
|
| 121 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 122 |
-
inputs=params +
|
| 123 |
outputs=[tb_indicator, files_subtitles])
|
| 124 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 125 |
|
|
@@ -133,7 +133,7 @@ class App:
|
|
| 133 |
tb_title = gr.Label(label=_("Youtube Title"))
|
| 134 |
tb_description = gr.Textbox(label=_("Youtube Description"), max_lines=15)
|
| 135 |
|
| 136 |
-
|
| 137 |
|
| 138 |
with gr.Row():
|
| 139 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
@@ -145,7 +145,7 @@ class App:
|
|
| 145 |
params = [tb_youtubelink, dd_file_format, cb_timestamp]
|
| 146 |
|
| 147 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
| 148 |
-
inputs=params +
|
| 149 |
outputs=[tb_indicator, files_subtitles])
|
| 150 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
| 151 |
outputs=[img_thumbnail, tb_title, tb_description])
|
|
@@ -155,7 +155,7 @@ class App:
|
|
| 155 |
with gr.Row():
|
| 156 |
mic_input = gr.Microphone(label=_("Record with Mic"), type="filepath", interactive=True)
|
| 157 |
|
| 158 |
-
|
| 159 |
|
| 160 |
with gr.Row():
|
| 161 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
@@ -167,7 +167,7 @@ class App:
|
|
| 167 |
params = [mic_input, dd_file_format, cb_timestamp]
|
| 168 |
|
| 169 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 170 |
-
inputs=params +
|
| 171 |
outputs=[tb_indicator, files_subtitles])
|
| 172 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 173 |
|
|
|
|
| 44 |
print(f"Use \"{self.args.whisper_type}\" implementation\n"
|
| 45 |
f"Device \"{self.whisper_inf.device}\" is detected")
|
| 46 |
|
| 47 |
+
def create_pipeline_inputs(self):
|
| 48 |
whisper_params = self.default_params["whisper"]
|
| 49 |
vad_params = self.default_params["vad"]
|
| 50 |
diarization_params = self.default_params["diarization"]
|
|
|
|
| 108 |
visible=self.args.colab,
|
| 109 |
value="")
|
| 110 |
|
| 111 |
+
pipeline_params, dd_file_format, cb_timestamp = self.create_pipeline_inputs()
|
| 112 |
|
| 113 |
with gr.Row():
|
| 114 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
|
|
| 119 |
|
| 120 |
params = [input_file, tb_input_folder, dd_file_format, cb_timestamp]
|
| 121 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 122 |
+
inputs=params + pipeline_params,
|
| 123 |
outputs=[tb_indicator, files_subtitles])
|
| 124 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 125 |
|
|
|
|
| 133 |
tb_title = gr.Label(label=_("Youtube Title"))
|
| 134 |
tb_description = gr.Textbox(label=_("Youtube Description"), max_lines=15)
|
| 135 |
|
| 136 |
+
pipeline_params, dd_file_format, cb_timestamp = self.create_pipeline_inputs()
|
| 137 |
|
| 138 |
with gr.Row():
|
| 139 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
|
|
| 145 |
params = [tb_youtubelink, dd_file_format, cb_timestamp]
|
| 146 |
|
| 147 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
| 148 |
+
inputs=params + pipeline_params,
|
| 149 |
outputs=[tb_indicator, files_subtitles])
|
| 150 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
| 151 |
outputs=[img_thumbnail, tb_title, tb_description])
|
|
|
|
| 155 |
with gr.Row():
|
| 156 |
mic_input = gr.Microphone(label=_("Record with Mic"), type="filepath", interactive=True)
|
| 157 |
|
| 158 |
+
pipeline_params, dd_file_format, cb_timestamp = self.create_pipeline_inputs()
|
| 159 |
|
| 160 |
with gr.Row():
|
| 161 |
btn_run = gr.Button(_("GENERATE SUBTITLE FILE"), variant="primary")
|
|
|
|
| 167 |
params = [mic_input, dd_file_format, cb_timestamp]
|
| 168 |
|
| 169 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 170 |
+
inputs=params + pipeline_params,
|
| 171 |
outputs=[tb_indicator, files_subtitles])
|
| 172 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 173 |
|