Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
p = pipeline("automatic-speech-recognition",
|
6 |
+
model = 'carlosdanielhernandezmena/whisper-large-faroese-8k-steps-100h-ct2')
|
7 |
+
|
8 |
+
def transcribe(audio, state=""):
|
9 |
+
time.sleep(3)
|
10 |
+
text = p(audio)["text"]
|
11 |
+
state += text + " "
|
12 |
+
return state, state
|
13 |
+
|
14 |
+
|
15 |
+
gr.Interface(
|
16 |
+
fn=transcribe,
|
17 |
+
inputs=[
|
18 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
19 |
+
'state'
|
20 |
+
],
|
21 |
+
outputs=[
|
22 |
+
"textbox",
|
23 |
+
"state"
|
24 |
+
],
|
25 |
+
live=True).launch()
|