|
from transformers.pipelines.audio_utils import ffmpeg_read |
|
from transformers import WhisperForConditionalGeneration, WhisperProcessor, pipeline |
|
import gradio as gr |
|
import numpy as np |
|
|
|
def process_transcribe(file): |
|
audio_nparray = file[1] |
|
my_list = audio_nparray.tolist() |
|
|
|
endpoint = runpod.Endpoint("14ggfq6a17uim9") |
|
|
|
run_request = endpoint.run_sync( |
|
{"audio_list": my_list} |
|
) |
|
raw_text = run_request |
|
|
|
return raw_text |
|
|
|
with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface: |
|
with gr.Tab("App"): |
|
with gr.Row(): |
|
with gr.Column(): |
|
audio_id = gr.Textbox(label="Audio") |
|
audio_file = gr.Audio(sources=["upload"], type="numpy") |
|
submit_btn = gr.Button("Submit", variant="primary") |
|
with gr.Column(): |
|
raw_transcript = gr.Textbox(label="Transcription") |
|
submit_btn.click(process_transcribe, inputs=[audio_file], outputs=[raw_transcript]) |
|
iface.launch(debug=True) |