Unable to use pyttsx3 library for a text to speech when using the streamlit server

I have created the following that prototypes a system to enable blind people to see. The link for the app is: vision-for-the-blind.streamlit.app
When I am testing my app locally the pyttsx3 library is working just fine however, when I upload the same code to the streamlit server via my github repo, I am getting the following error:

This is my github repo for the project: GitHub - adnanbarwaniwala/Vision-for-the-Blind

I am unable to understand why the error is occurring when I using the following snippet to convert text to audio:

Please help me out.

Thank you

1 Like

Hi @abarwaniwala11662

It seems that the error pertains to not being able to access model_response.wav file. Perhaps you can try using the NamedTemporaryFile method from the tempfile library to store the generated audio file tempfile — Generate temporary files and directories — Python 3.12.4 documentation which can then be used subsequently in the script.

2 Likes

Hi, in this same app I’m facing another error. When I’m running my app locally its working just fine but when running my website I’m consistently running into this same error and I don’t know how to resolve it. It’s as follows:

/home/adminuser/venv/lib/python3.11/site-packages/transformers/models/whisper/generation_whisper.py:496: FutureWarning: The input name `inputs` is deprecated. Please make sure to use `input_features` instead.

  warnings.warn(

The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.

/home/adminuser/venv/lib/python3.11/site-packages/pydantic/_internal/_config.py:341: UserWarning: Valid config keys have changed in V2:

* 'allow_population_by_field_name' has been renamed to 'populate_by_name'

* 'smart_union' has been removed

  warnings.warn(message, UserWarning)

/home/adminuser/venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py:161: UserWarning: Field "model_id" has conflict with protected namespace "model_".


You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.

  warnings.warn(

[19:10:34] ❗️ The service has encountered an error while checking the health of the Streamlit app: Get "http://localhost:8501/healthz": read tcp 127.0.0.1:57490->127.0.0.1:8501: read: connection reset by peer

/app/scripts/run-streamlit.sh: line 9:  2294 Killed                  sudo -E -u appuser /home/adminuser/venv/bin/streamlit "$@"

[19:12:09] ❗️ Streamlit server consistently failed status checks

[19:12:09] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

I think the error that I’m facing is because of the ASR model I’m using to convert the user audio input into text. The code for it is as follows:
image

The link to the github of my project is here: GitHub - adnanbarwaniwala/Vision-for-the-Blind: An AI-powered application designed to assist visually impaired individuals by providing real-time audio descriptions of their surroundings. IMP: Check the Note section of the readme file if using the app website.

The link to my website is: https://vision-for-the-blind.streamlit.app

Kindly help me resolve this issue. Thank you for spending your time and helping me out.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.