Spaces:
Runtime error
Runtime error
SameerMahajan
commited on
Commit
•
9bdbe4b
1
Parent(s):
b373ea1
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
def recognize_speech(audio):
|
6 |
+
print (type(audio))
|
7 |
+
transcriber = pipeline("automatic-speech-recognition", model="DrishtiSharma/whisper-large-v2-marathi")
|
8 |
+
sr, y = audio
|
9 |
+
y = y.astype(np.float32)
|
10 |
+
y /= np.max(np.abs(y))
|
11 |
+
return transcriber({"sampling_rate": sr, "raw": y})["text"]
|
12 |
+
|
13 |
+
gr.close_all()
|
14 |
+
demo = gr.Interface(fn=recognize_speech, inputs="audio", outputs="text")
|
15 |
+
demo.launch()
|