import gradio as gr from transformers import pipeline # Load the model asr = pipeline("automatic-speech-recognition", model="Abdallahsadek/speech-to-text-model2") # Transcription function def transcribe(audio): return asr(audio)["text"] # Gradio interface interface = gr.Interface( fn=transcribe, inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"), outputs="text", title="🎙️ Speech-to-Text", description="Speak or upload an audio file to transcribe it using Hugging Face model.", ) interface.launch()