Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
from huggingface_hub import login
|
| 5 |
+
|
| 6 |
+
login("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", add_to_git_credential=True)
|
| 7 |
+
|
| 8 |
+
pipe = pipeline(model="enniorampello/whisper-small-hi") # change to "your-username/the-name-you-picked"
|
| 9 |
+
|
| 10 |
+
def transcribe(audio):
|
| 11 |
+
text = pipe(audio)["text"]
|
| 12 |
+
return text
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=transcribe,
|
| 16 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
| 17 |
+
outputs="text",
|
| 18 |
+
title="Whisper Small Swedish",
|
| 19 |
+
description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
iface.launch()
|