sunbal7 commited on
Commit
fadb4c3
·
verified ·
1 Parent(s): ea1092e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -11,17 +11,23 @@ import os
11
  from dotenv import load_dotenv
12
  import pdfplumber # Alternative PDF library
13
 
14
- # Load environment variables
15
- load_dotenv()
16
-
17
- # --- Retrieve API Key ---
18
- API_KEY = os.getenv("OPENROUTER_API_KEY")
19
  if not API_KEY:
20
- st.error("OPENROUTER_API_KEY not found in environment variables! Please add it to your .env file.")
 
 
 
 
 
 
 
 
 
21
  st.stop()
22
 
 
23
  API_URL = "https://api.groq.com/openai/v1/chat/completions"
24
- MODEL = "llama3-70b-8192" # Or "mixtral-8x7b-32768" or "gemma-7b-it"
25
 
26
  # Set Tesseract path for different environments
27
  try:
 
11
  from dotenv import load_dotenv
12
  import pdfplumber # Alternative PDF library
13
 
14
+ API_KEY = os.environ.get('OPENROUTER_API_KEY')
 
 
 
 
15
  if not API_KEY:
16
+ st.error("""
17
+ **API Key Not Configured!**
18
+
19
+ Please add your API key to Hugging Face Spaces secrets:
20
+ 1. Go to your Space settings
21
+ 2. Select "Variables and secrets"
22
+ 3. Add a secret named: `OPENROUTER_API_KEY`
23
+ 4. Set its value to your actual API key
24
+ 5. Redeploy the space
25
+ """)
26
  st.stop()
27
 
28
+ # --- API Configuration ---
29
  API_URL = "https://api.groq.com/openai/v1/chat/completions"
30
+ MODEL = "llama3-70b-8192"
31
 
32
  # Set Tesseract path for different environments
33
  try: