Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import torch
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
+
|
9 |
+
|
10 |
+
pipe = pipeline(model="fahadqazi/whisper-small-sindhi", device=device) # 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(type="filepath"),
|
19 |
+
outputs="text",
|
20 |
+
title="Whisper Small Sindhi",
|
21 |
+
description="Realtime demo for Sindhi speech recognition using a fine-tuned Whisper small model.",
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|