import gradio as gr import speech_recognition as sr # Importing the speech_recognition module def transcribe_audio(file_info): recognizer = sr.Recognizer() audio_file = file_info['content'] with sr.AudioFile(audio_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()