File size: 1,002 Bytes
8bd9d02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2233c98
8bd9d02
 
 
 
 
 
 
 
2233c98
8bd9d02
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Let's get pipelines from transformers
from transformers import pipeline
# Let's import Gradio
import gradio as gr

# Let's set up the model
model = pipeline("automatic-speech-recognition", model="moraxgiga/audio_test")
title = "Audio2Text"
description = "Record your audio in English and send it in order to received a transcription"


# Function
def transcribe(audio):
  # Let's invoke "model" defined above
  text = model(audio)["text"]
  return text


# Interface Set-Up
'''gr.Interface(
    fn=transcribe,
    inputs=[gr.Audio(source="microphone", type="filepath")],
    title="Audio-to-text",
    description="text-to-speech model demo",
    outputs=["textbox"]
).launch()
'''

demo = gr.Interface(fn=transcribe ,
                    inputs=[gr.Audio(source="microphone", type="filepath")],
                    outputs=[gr.Textbox(label="Result", lines=3)],
                    title="Audio-to-text",
                    description="text-to-speech model demo"
                   )
demo.launch()