Spaces:
Running
Running
jhj0517
commited on
Commit
Β·
aad17fa
1
Parent(s):
8732fcd
Fix wrong parameters
Browse files- app.py +1 -1
- modules/whisper/whisper_base.py +5 -1
app.py
CHANGED
|
@@ -254,7 +254,7 @@ class App:
|
|
| 254 |
files_subtitles = gr.Files(label="Downloadable output file", scale=3)
|
| 255 |
btn_openfolder = gr.Button('π', scale=1)
|
| 256 |
|
| 257 |
-
params = [mic_input, dd_file_format]
|
| 258 |
|
| 259 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 260 |
inputs=params + whisper_params.as_list(),
|
|
|
|
| 254 |
files_subtitles = gr.Files(label="Downloadable output file", scale=3)
|
| 255 |
btn_openfolder = gr.Button('π', scale=1)
|
| 256 |
|
| 257 |
+
params = [mic_input, dd_file_format, cb_timestamp]
|
| 258 |
|
| 259 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 260 |
inputs=params + whisper_params.as_list(),
|
modules/whisper/whisper_base.py
CHANGED
|
@@ -224,6 +224,7 @@ class WhisperBase(ABC):
|
|
| 224 |
def transcribe_mic(self,
|
| 225 |
mic_audio: str,
|
| 226 |
file_format: str,
|
|
|
|
| 227 |
progress=gr.Progress(),
|
| 228 |
*whisper_params,
|
| 229 |
) -> list:
|
|
@@ -236,6 +237,8 @@ class WhisperBase(ABC):
|
|
| 236 |
Audio file path from gr.Microphone()
|
| 237 |
file_format: str
|
| 238 |
Subtitle File format to write from gr.Dropdown(). Supported format: [SRT, WebVTT, txt]
|
|
|
|
|
|
|
| 239 |
progress: gr.Progress
|
| 240 |
Indicator to show progress directly in gradio.
|
| 241 |
*whisper_params: tuple
|
|
@@ -253,6 +256,7 @@ class WhisperBase(ABC):
|
|
| 253 |
transcribed_segments, time_for_task = self.run(
|
| 254 |
mic_audio,
|
| 255 |
progress,
|
|
|
|
| 256 |
*whisper_params,
|
| 257 |
)
|
| 258 |
progress(1, desc="Completed!")
|
|
@@ -260,7 +264,7 @@ class WhisperBase(ABC):
|
|
| 260 |
subtitle, result_file_path = self.generate_and_write_file(
|
| 261 |
file_name="Mic",
|
| 262 |
transcribed_segments=transcribed_segments,
|
| 263 |
-
add_timestamp=
|
| 264 |
file_format=file_format,
|
| 265 |
output_dir=self.output_dir
|
| 266 |
)
|
|
|
|
| 224 |
def transcribe_mic(self,
|
| 225 |
mic_audio: str,
|
| 226 |
file_format: str,
|
| 227 |
+
add_timestamp: bool,
|
| 228 |
progress=gr.Progress(),
|
| 229 |
*whisper_params,
|
| 230 |
) -> list:
|
|
|
|
| 237 |
Audio file path from gr.Microphone()
|
| 238 |
file_format: str
|
| 239 |
Subtitle File format to write from gr.Dropdown(). Supported format: [SRT, WebVTT, txt]
|
| 240 |
+
add_timestamp: bool
|
| 241 |
+
Boolean value from gr.Checkbox() that determines whether to add a timestamp at the end of the filename.
|
| 242 |
progress: gr.Progress
|
| 243 |
Indicator to show progress directly in gradio.
|
| 244 |
*whisper_params: tuple
|
|
|
|
| 256 |
transcribed_segments, time_for_task = self.run(
|
| 257 |
mic_audio,
|
| 258 |
progress,
|
| 259 |
+
add_timestamp,
|
| 260 |
*whisper_params,
|
| 261 |
)
|
| 262 |
progress(1, desc="Completed!")
|
|
|
|
| 264 |
subtitle, result_file_path = self.generate_and_write_file(
|
| 265 |
file_name="Mic",
|
| 266 |
transcribed_segments=transcribed_segments,
|
| 267 |
+
add_timestamp=add_timestamp,
|
| 268 |
file_format=file_format,
|
| 269 |
output_dir=self.output_dir
|
| 270 |
)
|