hassenhamdi commited on
Commit
b9b27d9
·
verified ·
1 Parent(s): b2e12c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -12,6 +12,17 @@ from runner import Runner
12
  # Load environment variables from .env file at the very beginning
13
  load_dotenv()
14
 
 
 
 
 
 
 
 
 
 
 
 
15
  # Configure logging
16
  logging.basicConfig(level=logging.INFO, force=True)
17
  logger = logging.getLogger(__name__)
 
12
  # Load environment variables from .env file at the very beginning
13
  load_dotenv()
14
 
15
+ # Explicitly set environment variables for Pydantic Settings to ensure they are picked up
16
+ # This is a safeguard in case pydantic-settings doesn't automatically find them
17
+ # in certain execution environments (e.g., Hugging Face Spaces)
18
+ if os.getenv("USERNAME"):
19
+ os.environ["USERNAME"] = os.getenv("USERNAME")
20
+ if os.getenv("SPACE_ID"):
21
+ os.environ["SPACE_ID"] = os.getenv("SPACE_ID")
22
+ if os.getenv("GEMINI_API_KEY"):
23
+ os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY")
24
+
25
+
26
  # Configure logging
27
  logging.basicConfig(level=logging.INFO, force=True)
28
  logger = logging.getLogger(__name__)