File size: 478 Bytes
97d695c
e3ef543
97d695c
 
e3ef543
97d695c
 
 
 
 
 
 
 
e3ef543
43ba0a4
 
97d695c
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import pipeline

model_id = "tarteel-ai/whisper-base-ar-quran"  
pipe = pipeline("automatic-speech-recognition", model=model_id)

def transcribe(filepath):
    output = pipe(
        filepath,
        max_new_tokens=10000,
        chunk_length_s=30,
        batch_size=8,
    )
    return output["text"]

import gradio as gr

iface = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(source="upload", type="filepath"),
    outputs="text",
)

iface.launch()