arabeasy / app.py
geokanaan's picture
Update app.py
2c0f3d8
raw
history blame
737 Bytes
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):
sr, y = audio
y = y.astype(np.float32)
y /= np.max(np.abs(y))
return pipe({"sampling_rate": sr, "raw": y})["text"]
HF_TOKEN = os.getenv('WRITE')
#hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "geokanaan/flagged_Audio_Lebanese")
iface = gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(sources="microphone")
],
outputs="text",
title="arabeasy",
description="Realtime demo for Lebanese Arabizi speech recognition",
#allow_flagging='manual',
#flagging_callback=hf_writer
)
iface.launch()