File size: 769 Bytes
5cbdb9e
 
 
 
 
 
 
d84fe22
 
 
 
 
 
 
 
 
5cbdb9e
 
 
d84fe22
8351ce1
3581f0e
d84fe22
5cbdb9e
 
 
d84fe22
 
5cbdb9e
d84fe22
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
from transformers import pipeline
import os


pipe = pipeline(task="automatic-speech-recognition", model="geokanaan/Whisper_Base_Lebanese_Arabizi")



def transcribe(audio, actual_transcription):
    text = pipe(audio)
    return text['text']


HF_TOKEN = os.getenv('WRITE')
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "flagged_Audio_Lebanese")

iface = gr.Interface(
    fn=transcribe,
    inputs=[
        gr.Audio(sources="microphone", type="filepath"),
        gr.Textbox(label="Actual Transcription")  
    ],
    outputs="text",
    title="arabeasy",
    description="Realtime demo for Lebanese Arabizi speech recognition",
    allow_flagging='manual',  # Enable manual flagging
    flagging_callback=hf_writer
)

iface.launch(share=True)