Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +4 -4
src/streamlit_app.py
CHANGED
|
@@ -16,17 +16,17 @@ from streamlit_mic_recorder import mic_recorder # Key component for browser audi
|
|
| 16 |
|
| 17 |
# Load API Key from Streamlit/Hugging Face Secrets
|
| 18 |
# DO NOT hardcode your key. Add it to your HF Space's secrets.
|
|
|
|
| 19 |
try:
|
| 20 |
-
GOOGLE_API_KEY =
|
| 21 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 22 |
-
|
| 23 |
except KeyError:
|
| 24 |
-
st.error("GOOGLE_API_KEY not found in
|
| 25 |
st.stop()
|
| 26 |
except Exception as e:
|
| 27 |
st.error(f"Error configuring Google API: {e}", icon="🚨")
|
| 28 |
st.stop()
|
| 29 |
-
|
| 30 |
# --- Pydantic Models (from your code) ---
|
| 31 |
|
| 32 |
class questions(BaseModel):
|
|
|
|
| 16 |
|
| 17 |
# Load API Key from Streamlit/Hugging Face Secrets
|
| 18 |
# DO NOT hardcode your key. Add it to your HF Space's secrets.
|
| 19 |
+
|
| 20 |
try:
|
| 21 |
+
GOOGLE_API_KEY = os.environ["GOOGLE_API_KEY"]
|
| 22 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 23 |
+
|
| 24 |
except KeyError:
|
| 25 |
+
st.error("GOOGLE_API_KEY not found in Hugging Face secrets. Please go to your Space's 'Settings' tab and add it.", icon="🚨")
|
| 26 |
st.stop()
|
| 27 |
except Exception as e:
|
| 28 |
st.error(f"Error configuring Google API: {e}", icon="🚨")
|
| 29 |
st.stop()
|
|
|
|
| 30 |
# --- Pydantic Models (from your code) ---
|
| 31 |
|
| 32 |
class questions(BaseModel):
|