Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# model_interface = gr.Interface.load("models/jonatasgrosman/wav2vec2-large-xlsr-53-arabic", wait=True)
|
4 |
+
# model_interface.launch()
|
5 |
+
# Use a pipeline as a high-level helper
|
6 |
+
|
7 |
+
|
8 |
+
from transformers import pipeline
|
9 |
import gradio as gr
|
10 |
|
11 |
+
pipe = pipeline(model="jonatasgrosman/wav2vec2-large-xlsr-53-arabic") # change to "your-username/the-name-you-picked"
|
12 |
+
|
13 |
+
def transcribe(audio):
|
14 |
+
text = pipe(audio)["text"]
|
15 |
+
return text
|
16 |
+
|
17 |
+
iface = gr.Interface(
|
18 |
+
fn=transcribe,
|
19 |
+
inputs=gr.Audio(source="upload", type="filepath"),
|
20 |
+
outputs="text",
|
21 |
+
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|