Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
-
|
| 2 |
from transformers import pipeline
|
| 3 |
import gradio as gr
|
| 4 |
-
from evaluate import evaluator
|
| 5 |
-
from datasets import load_dataset
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
data = load_dataset("mskov/miso_test", "en", split="test[:40]")
|
| 10 |
-
results = task_evaluator.compute(
|
| 11 |
-
model_or_pipeline="https://huggingface.co/mskov/whisper_miso",
|
| 12 |
-
data=data,
|
| 13 |
-
input_column="path",
|
| 14 |
-
label_column="category",
|
| 15 |
-
metric="wer",
|
| 16 |
-
)
|
| 17 |
-
print(results)
|
| 18 |
-
# whisper_esc50 = pipeline(model="mskov/whisper_esc50")
|
| 19 |
-
#whisper_miso= pipeline(model="mskov/whisper_miso")
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
from transformers import pipeline
|
| 3 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
p = pipeline("automatic-speech-recognition")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
def transcribe(audio, state=""):
|
| 8 |
+
text = p(audio)["text"]
|
| 9 |
+
state += text + " "
|
| 10 |
+
return state, state
|
| 11 |
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=transcribe,
|
| 14 |
+
inputs=[
|
| 15 |
+
gr.Audio(source="microphone", type="filepath", streaming=True),
|
| 16 |
+
"state"
|
| 17 |
+
],
|
| 18 |
+
outputs=[
|
| 19 |
+
"textbox",
|
| 20 |
+
"state"
|
| 21 |
+
],
|
| 22 |
+
live=True).launch()
|