File size: 749 Bytes
158f7fc
 
 
3df5809
f3a4281
 
158f7fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()