Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Use the NCAIR Yoruba model
|
| 5 |
+
# This might require a slightly larger Space (CPU Upgrade) or might run slowly on Free Tier
|
| 6 |
+
transcriber = pipeline("automatic-speech-recognition", model="NCAIR1/Yoruba-ASR")
|
| 7 |
+
|
| 8 |
+
def transcribe(audio):
|
| 9 |
+
text = transcriber(audio)["text"]
|
| 10 |
+
return text
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=transcribe,
|
| 14 |
+
inputs=gr.Audio(type="filepath"), # Upload or Record audio
|
| 15 |
+
outputs="text",
|
| 16 |
+
title="Yoruba Speech Transcriber",
|
| 17 |
+
description="Speak or upload Yoruba audio to transcribe it to text."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
iface.launch()
|