import gradio as gr import numpy as np import runpod import os RUNPOD_API = os.environ.get("RUNPOD_API") RUNPOD_ENDPOINT = os.environ.get("RUNPOD_ENDPOINT") def process_transcribe(file): audio_nparray = file[1] audio_list = audio_nparray.tolist() runpod.api_key = RUNPOD_API endpoint = runpod.Endpoint(RUNPOD_ENDPOINT) run_request = endpoint.run_sync( {"audio_list": audio_list} ) raw_text = run_request return raw_text with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as iface: with gr.Tab("Speech2text prescription"): with gr.Row(): with gr.Column(): audio_file = gr.Audio(sources=["upload", "microphone"], type="numpy", label="Audio") 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)