jhj0517 commited on
Commit
8453b3d
·
1 Parent(s): 64a0826

add data classes for parameters

Browse files
Files changed (1) hide show
  1. modules/whisper_data_class.py +31 -0
modules/whisper_data_class.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass, fields
2
+ import gradio as gr
3
+
4
+
5
+ @dataclass
6
+ class WhisperGradioComponents:
7
+ model_size: gr.Dropdown
8
+ lang: gr.Dropdown
9
+ is_translate: gr.Checkbox
10
+ beam_size: gr.Number
11
+ log_prob_threshold: gr.Number
12
+ no_speech_threshold: gr.Number
13
+ compute_type: gr.Dropdown
14
+
15
+ def to_list(self):
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
+
23
+ @dataclass
24
+ class WhisperValues:
25
+ model_size: str
26
+ lang: str
27
+ is_translate: bool
28
+ beam_size: int
29
+ log_prob_threshold: float
30
+ no_speech_threshold: float
31
+ compute_type: str