Update app.py
Browse files
app.py
CHANGED
|
@@ -22,21 +22,6 @@ dataset = load_dataset("mskov/miso_test", split="test").cast_column("audio", Aud
|
|
| 22 |
|
| 23 |
print(dataset, "and at 0[audio][array] ", dataset[0]["audio"]["array"], type(dataset[0]["audio"]["array"]), "and at audio : ", dataset[0]["audio"])
|
| 24 |
|
| 25 |
-
|
| 26 |
-
def transcribe(audio):
|
| 27 |
-
text = pipe(audio)["text"]
|
| 28 |
-
test = evalWhisper(model, dataset)
|
| 29 |
-
return text, test
|
| 30 |
-
|
| 31 |
-
iface = gr.Interface(
|
| 32 |
-
fn=transcribe,
|
| 33 |
-
inputs=gr.Audio(source="microphone", type="filepath"),
|
| 34 |
-
outputs="text",
|
| 35 |
-
title="Whisper Small Miso Test",
|
| 36 |
-
)
|
| 37 |
-
|
| 38 |
-
iface.launch()
|
| 39 |
-
|
| 40 |
def evalWhisper(model, dataset):
|
| 41 |
model.eval()
|
| 42 |
print("model.eval ", model.eval())
|
|
@@ -61,6 +46,22 @@ def evalWhisper(model, dataset):
|
|
| 61 |
# Print or return WER score
|
| 62 |
print(f"Word Error Rate (WER): {wer_score}")
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
'''
|
| 65 |
print("check check")
|
| 66 |
print(inputs)
|
|
|
|
| 22 |
|
| 23 |
print(dataset, "and at 0[audio][array] ", dataset[0]["audio"]["array"], type(dataset[0]["audio"]["array"]), "and at audio : ", dataset[0]["audio"])
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
def evalWhisper(model, dataset):
|
| 26 |
model.eval()
|
| 27 |
print("model.eval ", model.eval())
|
|
|
|
| 46 |
# Print or return WER score
|
| 47 |
print(f"Word Error Rate (WER): {wer_score}")
|
| 48 |
|
| 49 |
+
|
| 50 |
+
def transcribe(audio):
|
| 51 |
+
text = pipe(audio)["text"]
|
| 52 |
+
test = evalWhisper(model, dataset)
|
| 53 |
+
return text, test
|
| 54 |
+
|
| 55 |
+
iface = gr.Interface(
|
| 56 |
+
fn=transcribe,
|
| 57 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
| 58 |
+
outputs="text",
|
| 59 |
+
title="Whisper Small Miso Test",
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
iface.launch()
|
| 63 |
+
|
| 64 |
+
|
| 65 |
'''
|
| 66 |
print("check check")
|
| 67 |
print(inputs)
|