Whisper-WebUI / modules /whisper_data_class.py
jhj0517
add data classes for parameters
8453b3d
raw
history blame
673 Bytes
from dataclasses import dataclass, fields
import gradio as gr
@dataclass
class WhisperGradioComponents:
model_size: gr.Dropdown
lang: gr.Dropdown
is_translate: gr.Checkbox
beam_size: gr.Number
log_prob_threshold: gr.Number
no_speech_threshold: gr.Number
compute_type: gr.Dropdown
def to_list(self):
return [getattr(self, f.name) for f in fields(self)]
@staticmethod
def to_values(*params):
return WhisperValues(*params)
@dataclass
class WhisperValues:
model_size: str
lang: str
is_translate: bool
beam_size: int
log_prob_threshold: float
no_speech_threshold: float
compute_type: str