File size: 698 Bytes
7646abb
 
 
2fd6d2b
 
7646abb
 
fd1e84b
2fd6d2b
fd1e84b
7646abb
 
2fd6d2b
7646abb
 
fd1e84b
7646abb
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import whisper
import gradio as gr

# Load the Whisper model (you can change "base" to "small", "medium", or "large" depending on your needs)
model = whisper.load_model("base")

# Define the transcription function
def transcribe(audio_file):
    # Transcribe the audio file using Whisper
    result = model.transcribe(audio_file)
    return result["text"]

# Gradio Interface for uploading audio and returning the transcription
iface = gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath"),  # Use 'filepath' to get the path to the uploaded file
    outputs="text",
    title="Whisper Transcription",
    description="Upload an audio or video file to transcribe."
)

iface.launch()