Speech2Text / main.py
DanielIglesias97's picture
First upload to the repo.
f37ac06
raw
history blame contribute delete
503 Bytes
import gradio as gr
import speech_recognition as sr
def transcribe(filename):
r = sr.Recognizer()
with sr.AudioFile(filename) as source:
# listen for the data (load audio to memory)
audio_data = r.record(source)
# recognize (convert from speech to text)
text = r.recognize_google(audio_data)
return text
demo = gr.Interface(
transcribe,
[gr.Audio(type="filepath")],
"textbox",
)
demo.launch(server_name="0.0.0.0", server_port=7860)