import gradio as gr | |
from transformers import pipeline | |
# Load the model separately | |
model = pipeline("automatic-speech-recognition", model="speechbrain/mtl-mimic-voicebank") | |
# Define a function to make predictions using the loaded model | |
def transcribe(audio): | |
return model(audio)["text"] | |
# Define a CSS string to hide the footer | |
custom_css = """ | |
footer {visibility: hidden;} | |
""" | |
# Create the Gradio interface | |
demo = gr.Interface( | |
fn=transcribe, # Function to process input | |
inputs=gr.Audio(source="microphone", type="filepath"), # Take audio input | |
outputs="text", # Display output as text | |
css=custom_css # Hide the Gradio footer | |
) | |
# Launch the interface | |
demo.launch() |