Spaces:
Build error
Build error
import gradio as gr | |
import whisper | |
# Load the Whisper model | |
model = whisper.load_model("base") | |
def transcribe_audio(audio): | |
""" | |
This function takes in an audio file and returns its transcription. | |
""" | |
# Transcribe the audio using Whisper | |
result = model.transcribe(audio) | |
return result['text'] | |
# Create the Gradio interface for real-time transcription | |
interface = gr.Interface( | |
fn=transcribe_audio, # Function to process the audio input | |
inputs=gr.Audio(source="microphone", type="filepath"), # Real-time audio input from the microphone | |
outputs="text", # Display the transcription as text | |
live=True # Enables real-time transcription | |
) | |
# Launch the Gradio interface | |
interface.launch(share=True) | |