commit
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
|
5 |
+
model = pipeline(task="automatic-speech-recognition",
|
6 |
+
model="facebook/s2t-medium-librispeech-asr")
|
7 |
+
|
8 |
+
|
9 |
+
def predict_speech_to_text(audio):
|
10 |
+
prediction = model(audio)
|
11 |
+
text = prediction['text']
|
12 |
+
return text
|
13 |
+
|
14 |
+
|
15 |
+
gr.Interface(fn=predict_speech_to_text,
|
16 |
+
title="π§π½βπ€ PROLOVE π₯°π ",
|
17 |
+
inputs=gr.inputs.Audio(
|
18 |
+
source="microphone", type="filepath", label="Input"),
|
19 |
+
outputs=gr.outputs.Textbox(label="Output"),
|
20 |
+
description="Using pipeline with Facebook S2T for ASR.",
|
21 |
+
examples=['ljspeech.wav'],
|
22 |
+
allow_flagging='never'
|
23 |
+
).launch()
|