Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,18 +5,28 @@
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import os
|
|
|
|
|
|
|
8 |
|
9 |
-
|
10 |
-
auth_token = os.getenv("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")
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
"
|
16 |
-
|
17 |
-
inputs="mic",
|
18 |
-
description="Let me try to guess what you're saying!",
|
19 |
-
api_key=auth_token
|
20 |
-
)
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import os
|
8 |
+
import transformers
|
9 |
+
from transformers import pipeline
|
10 |
+
import time
|
11 |
|
12 |
+
p = pipeline('automatic-speech-recognition', model='rohitp1/kkkh_whisper_small_distillation_att_loss_libri360_epochs_100_batch_4_concat_dataset')
|
|
|
13 |
|
14 |
+
def transcribe(audio, state=""):
|
15 |
+
time.sleep(3)
|
16 |
+
text = p(audio)["text"]
|
17 |
+
state += text + " "
|
18 |
+
return state, state
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
|
21 |
+
|
22 |
+
gr.Interface(
|
23 |
+
fn=transcribe,
|
24 |
+
inputs=[
|
25 |
+
gr.inputs.Audio(source="microphone", type="filepath"),
|
26 |
+
'state'
|
27 |
+
],
|
28 |
+
outputs=[
|
29 |
+
"textbox",
|
30 |
+
"state"
|
31 |
+
],
|
32 |
+
live=False).launch()
|