I have set the keys in TOML format in the advanced settings of the app on share.streamlit.io
When I deploy I am getting this error
KeyError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)File "/app/promptengineeringspecialists/app.py", line 80, in <module>
openai.api_key = st.secrets["OPENAI_KEY"]
~~~~~~~~~~^^^^^^^^^^^^^^File "/home/appuser/venv/lib/python3.11/site-packages/streamlit/runtime/secrets.py", line 311, in __getitem__
raise KeyError(_missing_key_error_message(key))
In my app I am using secrets.py instead of secrets.toml but that should not matter.
Maybe I am going about things wrong in the first place
My app is iterating through a list of urls i provide through google sheets. This means the app is connecting to google sheets and iterated through row data. The row data are urls to web pages where it scrapes content from the body using beautifulsoup. It then uses the scraped data to rewrite content based on a prompt I have embedded in the code. The output is placed in a new sheet.
I am able to run this locally no problem. What I am unable to do is to get streamlit to run the app using the share.streamlit.io service
I have been trying for weeks to connect. I have many apps that do different tasks for me but all share a common thread in that they are iterating through rows of data in a google sheet, parse it and replace it in a new sheet using gpt to rewrite the data. In some cases I am merely using apps script with functions like combine, find and replace, match and so on…
My goal is to publish all of these apps I have locally to the web and charge a subscription fee to access them. I was hoping to use streamlit for my hosting service.
Can you help me please, at this stage I am pulling hair out of my head. I’m sure its a simple fix I just have not been able to find the right combination.
This was your original code that I was asking about. In your original post, you said you had a key error, which was expected because it wasn’t calling to the [secrets] section within st.secrets as needed per your description of your secrets file.
What error are you getting now? Are you still getting a key error or do you get a different error now?
You mentioned OpenAI keys, but how are you handling your Google credentials then? Is it OpenAI or Google that you are failing to connect to through Community Cloud?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.