Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -158,14 +158,11 @@ mms_model.load_adapter("mkd")
|
|
158 |
|
159 |
# Create a partial function with the device pre-applied
|
160 |
return_prediction_whisper_with_device = partial(return_prediction_whisper, device=device)
|
161 |
-
return_prediction_w2v2_with_device = partial(return_prediction_w2v2, device=device)
|
162 |
return_prediction_with_device_compare = partial(return_prediction_compare, device=device)
|
163 |
|
164 |
|
165 |
# Load the ASR models
|
166 |
-
w2v2_classifier = foreign_class(source="Macedonian-ASR/wav2vec2-aed-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
|
167 |
-
w2v2_classifier = w2v2_classifier.to(device)
|
168 |
-
w2v2_classifier.eval()
|
169 |
whisper_classifier = foreign_class(source="Macedonian-ASR/whisper-large-v3-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
|
170 |
whisper_classifier = whisper_classifier.to(device)
|
171 |
whisper_classifier.eval()
|
@@ -179,38 +176,6 @@ recap_model.to(device)
|
|
179 |
recap_model.eval()
|
180 |
|
181 |
|
182 |
-
mic_transcribe_whisper = gr.Interface(
|
183 |
-
fn=return_prediction_whisper_with_device,
|
184 |
-
inputs=gr.Audio(sources="microphone", type="filepath"),
|
185 |
-
outputs=gr.Textbox(),
|
186 |
-
allow_flagging="never",
|
187 |
-
live=False,
|
188 |
-
)
|
189 |
-
|
190 |
-
# file_transcribe_whisper = gr.Interface(
|
191 |
-
# fn=return_prediction_whisper_with_device,
|
192 |
-
# inputs=gr.Audio(sources="upload", type="filepath"),
|
193 |
-
# outputs=gr.Textbox(),
|
194 |
-
# allow_flagging="never",
|
195 |
-
# live=False
|
196 |
-
# )
|
197 |
-
|
198 |
-
mic_transcribe_w2v2 = gr.Interface(
|
199 |
-
fn=return_prediction_w2v2_with_device,
|
200 |
-
inputs=gr.Audio(sources="microphone", type="filepath"),
|
201 |
-
outputs=gr.Textbox(),
|
202 |
-
allow_flagging="never",
|
203 |
-
live=False,
|
204 |
-
)
|
205 |
-
|
206 |
-
|
207 |
-
# file_transcribe_w2v2 = gr.Interface(
|
208 |
-
# fn=return_prediction_w2v2_with_device,
|
209 |
-
# inputs=gr.Audio(sources="upload", type="filepath"),
|
210 |
-
# outputs=gr.Textbox(),
|
211 |
-
# allow_flagging="never",
|
212 |
-
# live=False
|
213 |
-
# )
|
214 |
|
215 |
mic_transcribe_compare = gr.Interface(
|
216 |
fn=return_prediction_with_device_compare,
|
@@ -271,8 +236,8 @@ with transcriber_app:
|
|
271 |
# state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
|
272 |
|
273 |
gr.TabbedInterface(
|
274 |
-
[
|
275 |
-
["
|
276 |
)
|
277 |
state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
|
278 |
|
|
|
158 |
|
159 |
# Create a partial function with the device pre-applied
|
160 |
return_prediction_whisper_with_device = partial(return_prediction_whisper, device=device)
|
161 |
+
# return_prediction_w2v2_with_device = partial(return_prediction_w2v2, device=device)
|
162 |
return_prediction_with_device_compare = partial(return_prediction_compare, device=device)
|
163 |
|
164 |
|
165 |
# Load the ASR models
|
|
|
|
|
|
|
166 |
whisper_classifier = foreign_class(source="Macedonian-ASR/whisper-large-v3-macedonian-asr", pymodule_file="custom_interface_app.py", classname="ASR")
|
167 |
whisper_classifier = whisper_classifier.to(device)
|
168 |
whisper_classifier.eval()
|
|
|
176 |
recap_model.eval()
|
177 |
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
mic_transcribe_compare = gr.Interface(
|
181 |
fn=return_prediction_with_device_compare,
|
|
|
236 |
# state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
|
237 |
|
238 |
gr.TabbedInterface(
|
239 |
+
[mic_transcribe_compare],
|
240 |
+
["Споредба на модели"],
|
241 |
)
|
242 |
state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
|
243 |
|