stucork
December 22, 2020, 9:46am
5
You could definitely work out how to record the audio on the client and then send that to a server module, then handle the speech recognition in python
You might find this related post useful
Hi @soadadfarhan ,
The second example on the speech_recognition home page looks like it would do what you want. In particular, it seems that you need to ‘record’ the contents of the audio file using the Recognizer:
r = sr.Recognizer()
with anvil.media.TempFile(AudioFile) as file_name:
with sr.AudioFile(file_name) as source:
audio = r.record(source)
response = r.recognize_google(audio)
Hopefully that should do roughly what you want! If you still see errors, then @stuco…
Here is a small example that takes the example script from MDN
and makes it python/anvil using https://anvil.works/docs/client/javascript
(It only works on Chrome)