Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,22 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
5 |
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
-
with gr.Blocks() as iface:
|
12 |
with gr.Tab("App"):
|
13 |
with gr.Row():
|
14 |
with gr.Column():
|
@@ -17,5 +25,5 @@ with gr.Blocks() as iface:
|
|
17 |
submit_btn = gr.Button("Submit", variant="primary")
|
18 |
with gr.Column():
|
19 |
raw_transcript = gr.Textbox(label="Transcription")
|
20 |
-
submit_btn.click(process_transcribe, inputs=[
|
21 |
-
iface.launch()
|
|
|
1 |
+
from transformers.pipelines.audio_utils import ffmpeg_read
|
2 |
+
from transformers import WhisperForConditionalGeneration, WhisperProcessor, pipeline
|
3 |
import gradio as gr
|
4 |
+
import numpy as np
|
5 |
|
6 |
+
def process_transcribe(file):
|
7 |
+
audio_nparray = file[1]
|
8 |
+
my_list = audio_nparray.tolist()
|
9 |
|
10 |
+
endpoint = runpod.Endpoint("14ggfq6a17uim9")
|
11 |
|
12 |
+
run_request = endpoint.run_sync(
|
13 |
+
{"audio_list": my_list}
|
14 |
+
)
|
15 |
+
raw_text = run_request
|
16 |
+
|
17 |
+
return raw_text
|
18 |
|
19 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface:
|
20 |
with gr.Tab("App"):
|
21 |
with gr.Row():
|
22 |
with gr.Column():
|
|
|
25 |
submit_btn = gr.Button("Submit", variant="primary")
|
26 |
with gr.Column():
|
27 |
raw_transcript = gr.Textbox(label="Transcription")
|
28 |
+
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[raw_transcript])
|
29 |
+
iface.launch(debug=True)
|