Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,21 @@
|
|
1 |
-
# import gradio as gr
|
2 |
-
|
3 |
-
# gr.load("models/openai/whisper-large-v3-turbo").launch()
|
4 |
-
|
5 |
-
|
6 |
import gradio as gr
|
7 |
|
8 |
-
# Define a function
|
9 |
def process_transcription(audio_input):
|
10 |
-
model
|
|
|
11 |
result = model(audio_input)
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
# Launch the
|
18 |
-
|
19 |
-
fn=process_transcription,
|
20 |
-
inputs="audio",
|
21 |
-
outputs="text",
|
22 |
-
live=True,
|
23 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Define a processing function that directly returns the transcription
|
4 |
def process_transcription(audio_input):
|
5 |
+
# Load the Whisper model and get the result
|
6 |
+
model = gr.load("models/openai/whisper-large-v3-turbo") # Use gr.load in the correct way
|
7 |
result = model(audio_input)
|
8 |
|
9 |
+
# Return only the transcription text
|
10 |
+
return result["text"]
|
11 |
+
|
12 |
+
# Use a Gradio interface to launch the app
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
audio_input = gr.Audio(source="microphone", type="filepath", label="Input Audio")
|
15 |
+
transcription_output = gr.Textbox(label="Transcription")
|
16 |
+
|
17 |
+
# Add interaction
|
18 |
+
audio_input.change(process_transcription, inputs=audio_input, outputs=transcription_output)
|
19 |
|
20 |
+
# Launch the app
|
21 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|