Spaces:
Running
Running
jhj0517
commited on
Commit
·
03ff6dd
1
Parent(s):
f717773
add docstring
Browse files
modules/whisper_data_class.py
CHANGED
|
@@ -11,12 +11,51 @@ class WhisperGradioComponents:
|
|
| 11 |
log_prob_threshold: gr.Number
|
| 12 |
no_speech_threshold: gr.Number
|
| 13 |
compute_type: gr.Dropdown
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
return [getattr(self, f.name) for f in fields(self)]
|
| 17 |
|
| 18 |
@staticmethod
|
| 19 |
def to_values(*params):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
return WhisperValues(*params)
|
| 21 |
|
| 22 |
|
|
@@ -29,3 +68,7 @@ class WhisperValues:
|
|
| 29 |
log_prob_threshold: float
|
| 30 |
no_speech_threshold: float
|
| 31 |
compute_type: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
log_prob_threshold: gr.Number
|
| 12 |
no_speech_threshold: gr.Number
|
| 13 |
compute_type: gr.Dropdown
|
| 14 |
+
"""
|
| 15 |
+
A data class to pass Gradio components to the function before Gradio pre-processing.
|
| 16 |
+
See this documentation for more info: https://www.gradio.app/docs/components
|
| 17 |
|
| 18 |
+
Parameters
|
| 19 |
+
----------
|
| 20 |
+
model_size: gr.Dropdown
|
| 21 |
+
Whisper model size.
|
| 22 |
+
lang: gr.Dropdown
|
| 23 |
+
Source language of the file to transcribe.
|
| 24 |
+
is_translate: gr.Checkbox
|
| 25 |
+
Boolean value that determines whether to translate to English.
|
| 26 |
+
It's Whisper's feature to translate speech from another language directly into English end-to-end.
|
| 27 |
+
beam_size: gr.Number
|
| 28 |
+
Int value that is used for decoding option.
|
| 29 |
+
log_prob_threshold: gr.Number
|
| 30 |
+
If the average log probability over sampled tokens is below this value, treat as failed.
|
| 31 |
+
no_speech_threshold: gr.Number
|
| 32 |
+
If the no_speech probability is higher than this value AND
|
| 33 |
+
the average log probability over sampled tokens is below `log_prob_threshold`,
|
| 34 |
+
consider the segment as silent.
|
| 35 |
+
compute_type: gr.Dropdown
|
| 36 |
+
compute type for transcription.
|
| 37 |
+
see more info : https://opennmt.net/CTranslate2/quantization.html
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
def to_list(self) -> list:
|
| 41 |
+
"""
|
| 42 |
+
Use this to pass parameters before Gradio pre-processing to the function.
|
| 43 |
+
|
| 44 |
+
Returns
|
| 45 |
+
----------
|
| 46 |
+
A list of Gradio components
|
| 47 |
+
"""
|
| 48 |
return [getattr(self, f.name) for f in fields(self)]
|
| 49 |
|
| 50 |
@staticmethod
|
| 51 |
def to_values(*params):
|
| 52 |
+
"""
|
| 53 |
+
Use this to use parameters after Gradio pre-processing in the function.
|
| 54 |
+
|
| 55 |
+
Returns
|
| 56 |
+
----------
|
| 57 |
+
A WhisperValues data class
|
| 58 |
+
"""
|
| 59 |
return WhisperValues(*params)
|
| 60 |
|
| 61 |
|
|
|
|
| 68 |
log_prob_threshold: float
|
| 69 |
no_speech_threshold: float
|
| 70 |
compute_type: str
|
| 71 |
+
"""
|
| 72 |
+
A data class to use Whisper parameters in the function after gradio pre-processing.
|
| 73 |
+
See this documentation for more info : https://www.gradio.app/docs/components
|
| 74 |
+
"""
|