pinge commited on
Commit
ff47fb6
·
verified ·
1 Parent(s): d5b6c0b

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +4 -7
src/streamlit_app.py CHANGED
@@ -5,16 +5,13 @@ import os
5
  from dotenv import load_dotenv
6
  from langchain_community.document_loaders import WebBaseLoader
7
 
8
- # Load environment variables for local testing
9
  load_dotenv()
10
 
11
- # Get API key from Hugging Face Secrets or .env
12
- try:
13
- api_key = st.secrets['GROQ_API_KEY']
14
- except KeyError:
15
- api_key = os.getenv('GROQ_API_KEY')
16
  if not api_key:
17
- st.error("GROQ_API_KEY not found in Hugging Face Secrets or environment variables. Please ensure it is set in Space Settings > Secrets or a local .env file.")
18
  st.stop()
19
 
20
  # Function to load the article/blog post from a URL
 
5
  from dotenv import load_dotenv
6
  from langchain_community.document_loaders import WebBaseLoader
7
 
8
+ # Load environment variables
9
  load_dotenv()
10
 
11
+ # Get API key from .env
12
+ api_key = os.getenv('GROQ_API_KEY')
 
 
 
13
  if not api_key:
14
+ st.error("GROQ_API_KEY not found in .env file. Please add it to the .env file in your Hugging Face Space or local environment.")
15
  st.stop()
16
 
17
  # Function to load the article/blog post from a URL