BlahBlah314 commited on
Commit
3d4f76a
·
verified ·
1 Parent(s): 414a422

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -1,14 +1,22 @@
 
 
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
 
6
 
7
- def process_transcribe(file):
8
- print(file)
9
- return file
 
 
 
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=[audio_id], outputs=[raw_transcript])
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)