Spaces:
Running
Running
jhj0517
commited on
Commit
·
6148cfe
1
Parent(s):
ca8ee6a
rename function
Browse files
app.py
CHANGED
|
@@ -149,7 +149,7 @@ class App:
|
|
| 149 |
hf_token=tb_hf_token)
|
| 150 |
|
| 151 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 152 |
-
inputs=params + whisper_params.
|
| 153 |
outputs=[tb_indicator, files_subtitles])
|
| 154 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 155 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
|
@@ -231,7 +231,7 @@ class App:
|
|
| 231 |
hf_token=tb_hf_token)
|
| 232 |
|
| 233 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
| 234 |
-
inputs=params + whisper_params.
|
| 235 |
outputs=[tb_indicator, files_subtitles])
|
| 236 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
| 237 |
outputs=[img_thumbnail, tb_title, tb_description])
|
|
@@ -305,7 +305,7 @@ class App:
|
|
| 305 |
hf_token=tb_hf_token)
|
| 306 |
|
| 307 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 308 |
-
inputs=params + whisper_params.
|
| 309 |
outputs=[tb_indicator, files_subtitles])
|
| 310 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 311 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
|
|
|
| 149 |
hf_token=tb_hf_token)
|
| 150 |
|
| 151 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
| 152 |
+
inputs=params + whisper_params.as_list(),
|
| 153 |
outputs=[tb_indicator, files_subtitles])
|
| 154 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 155 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
|
|
|
| 231 |
hf_token=tb_hf_token)
|
| 232 |
|
| 233 |
btn_run.click(fn=self.whisper_inf.transcribe_youtube,
|
| 234 |
+
inputs=params + whisper_params.as_list(),
|
| 235 |
outputs=[tb_indicator, files_subtitles])
|
| 236 |
tb_youtubelink.change(get_ytmetas, inputs=[tb_youtubelink],
|
| 237 |
outputs=[img_thumbnail, tb_title, tb_description])
|
|
|
|
| 305 |
hf_token=tb_hf_token)
|
| 306 |
|
| 307 |
btn_run.click(fn=self.whisper_inf.transcribe_mic,
|
| 308 |
+
inputs=params + whisper_params.as_list(),
|
| 309 |
outputs=[tb_indicator, files_subtitles])
|
| 310 |
btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
| 311 |
dd_model.change(fn=self.on_change_models, inputs=[dd_model], outputs=[cb_translate])
|
modules/faster_whisper_inference.py
CHANGED
|
@@ -52,7 +52,7 @@ class FasterWhisperInference(WhisperBase):
|
|
| 52 |
"""
|
| 53 |
start_time = time.time()
|
| 54 |
|
| 55 |
-
params = WhisperParameters.
|
| 56 |
|
| 57 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 58 |
self.update_model(params.model_size, params.compute_type, progress)
|
|
|
|
| 52 |
"""
|
| 53 |
start_time = time.time()
|
| 54 |
|
| 55 |
+
params = WhisperParameters.as_value(*whisper_params)
|
| 56 |
|
| 57 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 58 |
self.update_model(params.model_size, params.compute_type, progress)
|
modules/insanely_fast_whisper_inference.py
CHANGED
|
@@ -53,7 +53,7 @@ class InsanelyFastWhisperInference(WhisperBase):
|
|
| 53 |
elapsed time for transcription
|
| 54 |
"""
|
| 55 |
start_time = time.time()
|
| 56 |
-
params = WhisperParameters.
|
| 57 |
|
| 58 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 59 |
self.update_model(params.model_size, params.compute_type, progress)
|
|
|
|
| 53 |
elapsed time for transcription
|
| 54 |
"""
|
| 55 |
start_time = time.time()
|
| 56 |
+
params = WhisperParameters.as_value(*whisper_params)
|
| 57 |
|
| 58 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 59 |
self.update_model(params.model_size, params.compute_type, progress)
|
modules/whisper_Inference.py
CHANGED
|
@@ -45,7 +45,7 @@ class WhisperInference(WhisperBase):
|
|
| 45 |
elapsed time for transcription
|
| 46 |
"""
|
| 47 |
start_time = time.time()
|
| 48 |
-
params = WhisperParameters.
|
| 49 |
|
| 50 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 51 |
self.update_model(params.model_size, params.compute_type, progress)
|
|
|
|
| 45 |
elapsed time for transcription
|
| 46 |
"""
|
| 47 |
start_time = time.time()
|
| 48 |
+
params = WhisperParameters.as_value(*whisper_params)
|
| 49 |
|
| 50 |
if params.model_size != self.current_model_size or self.model is None or self.current_compute_type != params.compute_type:
|
| 51 |
self.update_model(params.model_size, params.compute_type, progress)
|
modules/whisper_parameter.py
CHANGED
|
@@ -133,7 +133,7 @@ class WhisperParameters:
|
|
| 133 |
Read more about : https://huggingface.co/pyannote/speaker-diarization-3.1#requirements
|
| 134 |
"""
|
| 135 |
|
| 136 |
-
def
|
| 137 |
"""
|
| 138 |
Converts the data class attributes into a list, Use in Gradio UI before Gradio pre-processing.
|
| 139 |
See more about Gradio pre-processing: : https://www.gradio.app/docs/components
|
|
@@ -145,7 +145,7 @@ class WhisperParameters:
|
|
| 145 |
return [getattr(self, f.name) for f in fields(self)]
|
| 146 |
|
| 147 |
@staticmethod
|
| 148 |
-
def
|
| 149 |
"""
|
| 150 |
To use Whisper parameters in function after Gradio post-processing.
|
| 151 |
See more about Gradio post-processing: : https://www.gradio.app/docs/components
|
|
|
|
| 133 |
Read more about : https://huggingface.co/pyannote/speaker-diarization-3.1#requirements
|
| 134 |
"""
|
| 135 |
|
| 136 |
+
def as_list(self) -> list:
|
| 137 |
"""
|
| 138 |
Converts the data class attributes into a list, Use in Gradio UI before Gradio pre-processing.
|
| 139 |
See more about Gradio pre-processing: : https://www.gradio.app/docs/components
|
|
|
|
| 145 |
return [getattr(self, f.name) for f in fields(self)]
|
| 146 |
|
| 147 |
@staticmethod
|
| 148 |
+
def as_value(*args) -> 'WhisperValues':
|
| 149 |
"""
|
| 150 |
To use Whisper parameters in function after Gradio post-processing.
|
| 151 |
See more about Gradio post-processing: : https://www.gradio.app/docs/components
|