Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
import os
|
5 |
+
from huggingface_hub import login
|
6 |
+
login(token=os.environ.get("HF_TOKEN"))
|
7 |
+
pipe = pipeline("automatic-speech-recognition", model="aisha-org/Whisper-Uzbek")
|
8 |
+
|
9 |
+
def transcribe_audio(audio_file):
|
10 |
+
result = pipe(audio_file)
|
11 |
+
return result["text"]
|
12 |
+
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=transcribe_audio,
|
15 |
+
inputs=gr.Audio(type="filepath"),
|
16 |
+
outputs="text",
|
17 |
+
title="Audio Transcription",
|
18 |
+
# description=""
|
19 |
+
)
|
20 |
+
|
21 |
+
iface.launch()
|