I’m trying to set GOOGLE_APPLICATION_CREDENTIALS in Streamlit, to use Google APIs.
I’m doing so via the via the file uploader - please find the code below:
uploaded_file = st.file_uploader("File 1", type="json") import os if uploaded_file is not None: data = pd.read_json(uploaded_file, orient='index') os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = data st.write(data)
Here’s the error I get:
TypeError: str expected, not DataFrame
So if I understand correctly, I need to get a string (that is, the path to the JSON file), whereas
read_json outputs a dataframe.
Any idea on how to get that JSON file path?