ABSTRACTAI / app.py
Manickz's picture
Update app.py
228f3d2 verified
Raw History Blame Contribute Delete
851 Bytes
import gradio as gr
from transformers import pipeline
# Load the Whisper-large-v3 model from Hugging Face on CPU
transcriber = pipeline(
"automatic-speech-recognition",
model="openai/whisper-large-v3",
device=-1 # Ensures the model runs on the CPU
)
def transcribe_audio(file_path):
# Transcribe the audio file from the given file path
transcription = transcriber(file_path)["text"]
return transcription
# Gradio interface setup with file path input
iface = gr.Interface(
fn=transcribe_audio,
inputs=gr.Textbox(label="Enter the file path of the audio", placeholder="e.g., /path/to/audio.wav"),
outputs="text",
title="Whisper Large v3 ASR",
description="Transcribe audio files using OpenAI's Whisper Large v3 model. Provide the file path of the audio file.",
)
# Launch the app
iface.launch(share=True)