eleeter commited on
Commit
d5de0e1
·
verified ·
1 Parent(s): b2f687c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -5,6 +5,14 @@ from openai import OpenAI
5
  from collections import defaultdict
6
  import time
7
 
 
 
 
 
 
 
 
 
8
  # ── Read keys from environment variables (never hardcode these!) ──
9
  API_KEYS = {
10
  "groq": os.environ.get("GROQ_API_KEY"),
 
5
  from collections import defaultdict
6
  import time
7
 
8
+ # Loads keys from .env file when running locally
9
+ # On HuggingFace/Colab the env vars are already set so this just does nothing
10
+ try:
11
+ from dotenv import load_dotenv
12
+ load_dotenv()
13
+ except ImportError:
14
+ pass # dotenv not installed (HF/Colab don't need it)
15
+
16
  # ── Read keys from environment variables (never hardcode these!) ──
17
  API_KEYS = {
18
  "groq": os.environ.get("GROQ_API_KEY"),