Porjaz commited on
Commit
17b3912
·
verified ·
1 Parent(s): 0c2138d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -130,13 +130,16 @@ def return_prediction_compare(mic=None, file=None, device=device):
130
 
131
  # Create a partial function with the device pre-applied
132
  return_prediction_whisper_with_device = partial(return_prediction_whisper, device=device)
133
-
134
 
135
  # Load the ASR models
136
  whisper_classifier = foreign_class(source="Macedonian-ASR/whisper-large-v3-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
137
  whisper_classifier = whisper_classifier.to(device)
138
  whisper_classifier.eval()
139
 
 
 
 
140
 
141
  # Load the T5 tokenizer and model for restoring capitalization
142
  recap_model_name = "Macedonian-ASR/mt5-restore-capitalization-macedonian"
@@ -162,6 +165,13 @@ mic_transcribe_whisper = gr.Interface(
162
  # live=False
163
  # )
164
 
 
 
 
 
 
 
 
165
 
166
  project_description = '''
167
  <img src="https://i.imghippo.com/files/JXadQ1728417387.png"
@@ -214,8 +224,8 @@ with transcriber_app:
214
  # state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
215
 
216
  gr.TabbedInterface(
217
- [mic_transcribe_whisper],
218
- ["Буки-Whisper транскрипција"],
219
  )
220
  state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
221
 
 
130
 
131
  # Create a partial function with the device pre-applied
132
  return_prediction_whisper_with_device = partial(return_prediction_whisper, device=device)
133
+ return_prediction_w2v2_with_device = partial(return_prediction_w2v2, device=device)
134
 
135
  # Load the ASR models
136
  whisper_classifier = foreign_class(source="Macedonian-ASR/whisper-large-v3-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
137
  whisper_classifier = whisper_classifier.to(device)
138
  whisper_classifier.eval()
139
 
140
+ w2v2_classifier = foreign_class(source="Macedonian-ASR/wav2vec2-aed-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
141
+ w2v2_classifier = w2v2_classifier.to(device)
142
+ w2v2_classifier.eval()
143
 
144
  # Load the T5 tokenizer and model for restoring capitalization
145
  recap_model_name = "Macedonian-ASR/mt5-restore-capitalization-macedonian"
 
165
  # live=False
166
  # )
167
 
168
+ mic_transcribe_w2v2 = gr.Interface(
169
+ fn=return_prediction_w2v2_with_device,
170
+ inputs=gr.Audio(sources="microphone", type="filepath"),
171
+ outputs=gr.Textbox(),
172
+ allow_flagging="never",
173
+ live=False,
174
+ )
175
 
176
  project_description = '''
177
  <img src="https://i.imghippo.com/files/JXadQ1728417387.png"
 
224
  # state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
225
 
226
  gr.TabbedInterface(
227
+ [mic_transcribe_whisper, mic_transcribe_w2v2],
228
+ ["Буки-Whisper транскрипција", "Буки-Wav2vec2 транскрипција"],
229
  )
230
  state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
231