|
import gradio as gr |
|
import whisper |
|
|
|
MODEL = whisper.load_model("base.en") |
|
|
|
|
|
def transcribe(audio): |
|
result = MODEL.transcribe(audio) |
|
|
|
try: |
|
return result["text"] |
|
except: |
|
return "" |
|
|
|
|
|
examples = [["apollo11_example.mp3"], ["ariane6_example.mp3"]] |
|
|
|
ui = gr.Interface( |
|
fn=transcribe, |
|
inputs=gr.Audio( |
|
sources=["microphone", "upload"], |
|
type="filepath", |
|
label="Input Audio", |
|
), |
|
outputs=gr.Textbox( |
|
label="Transcription", |
|
placeholder="The transcribed text will appear here...", |
|
), |
|
title="ECHO", |
|
description=""" |
|
This is a demo of the transcription capabilities of "ECHO". This could be adapded to run real-time transcription on a live audio stream like ISS communications. |
|
|
|
### How to use: |
|
1. **Record or Upload**: Click on the microphone icon 🎙️ to record audio, usign your microphone, or click on the upload button ⬆️ to upload an audio file. |
|
You can also use the **Examples** provided below, as inputs, by clicking on them. |
|
2. **Click Submit**: Clicking the submit button will transcribe the audio. |
|
3. **Read the Transcription**: The transcribed text will appear in the text box below the audio input section. |
|
""", |
|
examples=examples, |
|
) |
|
|
|
ui.launch() |
|
|