BeneKroetz
commited on
Commit
•
2fd6d2b
1
Parent(s):
7646abb
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
import whisper
|
2 |
import gradio as gr
|
3 |
|
4 |
-
# Load the Whisper model
|
5 |
-
model = whisper.load_model("base")
|
6 |
|
7 |
# Define the transcription function
|
8 |
def transcribe(audio):
|
9 |
-
# Transcribe the audio file
|
10 |
result = model.transcribe(audio)
|
11 |
return result["text"]
|
12 |
|
13 |
-
# Gradio Interface
|
14 |
iface = gr.Interface(
|
15 |
fn=transcribe,
|
16 |
-
inputs=gr.Audio(
|
17 |
outputs="text",
|
18 |
title="Whisper Transcription",
|
19 |
description="Upload an audio or video file to transcribe."
|
|
|
1 |
import whisper
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Load the Whisper model (you can change "base" to "small", "medium", or "large" depending on your needs)
|
5 |
+
model = whisper.load_model("base")
|
6 |
|
7 |
# Define the transcription function
|
8 |
def transcribe(audio):
|
9 |
+
# Transcribe the audio file using Whisper
|
10 |
result = model.transcribe(audio)
|
11 |
return result["text"]
|
12 |
|
13 |
+
# Gradio Interface for uploading audio and returning the transcription
|
14 |
iface = gr.Interface(
|
15 |
fn=transcribe,
|
16 |
+
inputs=gr.Audio(type="file"), # No need for 'source' argument
|
17 |
outputs="text",
|
18 |
title="Whisper Transcription",
|
19 |
description="Upload an audio or video file to transcribe."
|