Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| import torch | |
| import os | |
| from huggingface_hub import login | |
| login(token=os.environ.get("HF_TOKEN")) | |
| # Load the Whisper pipeline | |
| pipe = pipeline("automatic-speech-recognition", | |
| model="fanaf91318/whisper-large-v3") | |
| def transcribe_audio(audio_file): | |
| # Transcribe the audio | |
| result = pipe(audio_file) | |
| # Return the transcription | |
| return result["text"] | |
| # Create the Gradio interface | |
| iface = gr.Interface( | |
| fn=transcribe_audio, | |
| inputs=gr.Audio(type="filepath"), | |
| outputs="text", | |
| title="Whisper Large v3 Audio Transcription", | |
| description="Upload an audio file to get its transcription using Whisper Large v3." | |
| ) | |
| # Launch the interface | |
| iface.launch() |