Not able to find .env file for OpenAI API key

Hi all!

I have created an app for my research and I need to connect it to OpenAI through an API.

I can run it locally when I define the paths locally. But when I change the path to BASE_FOLDER = "/mount/src/city-app/" which is what I see from os.path.abspath(".env"), it no longer works in deployment.

The issue is that OpenAI cannot find the .env file. I need the API file for the emotion analysis.

Here is the error:

App: https://city-app-mitra.streamlit.app/
Repository: https://github.com/mitramir55/city-app/blob/main/app.py

Any help is much appreciated!

Of course it canโ€™t, because there is no .env file in your github repo.
But i assume the .env file contains credentails, therefore better use st.secrets instead.

1 Like

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