corfodemo / app.py
sergiolucero's picture
Update app.py
7624a50 verified
raw
history blame
954 Bytes
import gradio as gr
from pydub import AudioSegment
from ailib import whisper_transcribe
def transcribe(audiofile):
#audio = AudioSegment.from_file(audiofile)
#open(filename, 'wb').write(audio)
return whisper_transcribe(audiofile)
# gr.title("Demo CORFO")
audemo = gr.Interface(
transcribe,
gr.Audio(sources=["microphone"], type="filepath"),
"text",
)
def display_text(option):
left = 'LEFT:' + option
right = 'RIGHT:' + option
return left, right
with gr.Blocks() as demo:
audemo
with gr.Row():
with gr.Column(scale=1):
radio = gr.Radio(choices=["Option 1", "Option 2"], label="Select an option", value="Option 1", interactive=True)
with gr.Column(scale=3):
with gr.Row():
left_text = gr.Markdown()
right_text = gr.Markdown()
radio.change(display_text, inputs=radio, outputs=[left_text, right_text])
demo.launch()