Dani
commited on
Commit
·
bd86a75
1
Parent(s):
6acc853
app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
from huggingface_hub import login
|
| 4 |
+
with open("../../token.txt", "r") as file:
|
| 5 |
+
token = file.readline().strip()
|
| 6 |
|
| 7 |
+
login(token=token, add_to_git_credential=True)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
pipe = pipeline(model="dacavi/whisper-small-hi") # change to "your-username/the-name-you-picked"
|
| 11 |
+
|
| 12 |
+
def transcribe(audio):
|
| 13 |
+
text = pipe(audio)["text"]
|
| 14 |
+
return text
|
| 15 |
+
|
| 16 |
+
iface = gr.Interface(
|
| 17 |
+
fn=transcribe,
|
| 18 |
+
inputs=gr.Audio(sources="microphone", type="filepath"),
|
| 19 |
+
outputs="text",
|
| 20 |
+
title="Whisper Small Hindi",
|
| 21 |
+
description="Realtime demo for Hindi speech recognition using a fine-tuned Whisper small model.",
|
| 22 |
+
)
|
| 23 |
|
|
|
|
| 24 |
iface.launch()
|