from flask import Flask, request | |
# import speech_recognition as sr | |
app = Flask(__name__) | |
# recognizer = sr.Recognizer() | |
def handle_audio(): | |
audio_data = request.data | |
print(audio_data) | |
# audio = sr.AudioData(audio_data, sample_rate=44100, sample_width=2) # Adjust sample rate and sample width as needed | |
# try: | |
# text = recognizer.recognize_google(audio) | |
# print(f"Transcription: {text}") | |
# return {'transcription': text}, 200 | |
# except sr.UnknownValueError: | |
# print("Could not understand audio") | |
# return '', 400 | |
# except sr.RequestError as e: | |
# print(f"Error from Google Speech Recognition service; {e}") | |
# return '', 500 | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=8723) # Replace with your desired host and port |