Spaces:
Sleeping
Sleeping
File size: 506 Bytes
a26860c 8f1209b a26860c 8f1209b a26860c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from speech_recognition import Recognizer, AudioFile
def transcribe_audio(file):
recognizer = Recognizer()
with AudioFile(file) as source:
audio_data = recognizer.record(source)
try:
text = recognizer.recognize_google(audio_data)
return text
except Exception as e:
return f"Error: {str(e)}"
iface = gr.Interface(
fn=transcribe_audio,
inputs=gr.inputs.Audio(source="microphone", type="file"),
outputs="text"
)
iface.launch() |