Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,23 @@
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# gr.load("models/openai/whisper-large-v3-turbo").launch()
|
4 |
+
|
5 |
import gradio as gr
|
6 |
+
from transformers import pipeline
|
7 |
+
model = gr.load("models/openai/whisper-large-v3-turbo")
|
8 |
+
|
9 |
+
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo")
|
10 |
+
# Define a function to process the output and extract only the transcription text
|
11 |
+
def process_transcription(audio_input):
|
12 |
+
|
13 |
+
result = pipe(audio_input)
|
14 |
+
# Extract the transcription text directly
|
15 |
+
transcription = result["text"]
|
16 |
+
return transcription
|
17 |
|
18 |
+
# Launch the interface
|
19 |
+
gr.Interface(
|
20 |
+
process_transcription,
|
21 |
+
gr.Audio(type="filepath"),
|
22 |
+
outputs="text"
|
23 |
+
).launch()
|