Not able to deploy my streamlit app on community cloud with backend of fastAPI

  1. Link to the app - https://farming-assistant.streamlit.app/

  2. My application’s GitHub repository - GitHub - NerdyPixie/Farming-Assistant

  3. The error I am getting : An error occurred: HTTPConnectionPool(host=‘localhost’, port=8000): Max retries exceeded with url: /predict (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7fce74092040>: Failed to establish a new connection: [Errno 111] Connection refused’))

I am able to run this application on my local machine, by running the FastAPI file, and running it on a local host. But the same does not happen when I deploy it on Streamlit. How do I enable the system to automatically make use of the FastAPI, to run the program with the backend?

Hey @NerdyPixie . Let me clear one thing that you need to use streamlit or flask? I have seen your GitHub repo. I saw streamlit.pu where it contians the while logic. If you deployed the application the image from uploading file gets to backend and perform operations and results displayed on screen. Then I think there is no use of fast-api. You can directly use the streamlit.py for both backend and frontend. So if you are interested then you need to mention the model path as:-

model_dir='models/1/1.keras'

#also you need to mention the class variables

Happy Streamlit-ing :balloon:

Hi! Thank you for your reply! I looked into it and fixed

model_dir='models/1/1.keras'

It works fine locally on streamlit, but when using it on streamlit cloud, it gives me the same error. Could you please help?

Thank you for your time.