Chris commited on
Commit
446334b
·
1 Parent(s): 49d2654
Files changed (1) hide show
  1. src/app.py +26 -17
src/app.py CHANGED
@@ -540,8 +540,12 @@ def create_interface():
540
  def main():
541
  """Main application entry point"""
542
 
543
- # Check if running in production
544
- is_production = os.getenv("GRADIO_ENV") == "production"
 
 
 
 
545
 
546
  # Check for space environment variables
547
  space_host = os.getenv("SPACE_HOST")
@@ -549,7 +553,7 @@ def main():
549
 
550
  if space_host:
551
  logger.info(f"✅ SPACE_HOST found: {space_host}")
552
- logger.info(f" Runtime URL: https://{space_host}.hf.space")
553
  else:
554
  logger.info("ℹ️ SPACE_HOST environment variable not found (running locally?).")
555
 
@@ -559,34 +563,39 @@ def main():
559
  else:
560
  logger.info("ℹ️ SPACE_ID environment variable not found (running locally?).")
561
 
 
 
562
  # Create interface
563
  interface = create_interface()
564
 
565
  # Launch configuration
566
- launch_kwargs = {
567
- "share": False,
568
- "debug": not is_production,
569
- "show_error": True,
570
- "quiet": is_production,
571
- "favicon_path": None
572
- }
573
-
574
  if is_production:
575
- # Production settings
576
- launch_kwargs.update({
577
  "server_name": "0.0.0.0",
578
  "server_port": int(os.getenv("PORT", 7860)),
 
 
 
 
 
579
  "auth": None
580
- })
 
581
  else:
582
  # Development settings
583
- launch_kwargs.update({
584
  "server_name": "127.0.0.1",
585
  "server_port": 7860,
 
 
 
 
 
586
  "inbrowser": True
587
- })
 
588
 
589
- logger.info("🚀 Launching GAIA Agent System...")
590
  interface.launch(**launch_kwargs)
591
 
592
  if __name__ == "__main__":
 
540
  def main():
541
  """Main application entry point"""
542
 
543
+ # Check if running in production (HuggingFace Spaces)
544
+ is_production = (
545
+ os.getenv("GRADIO_ENV") == "production" or
546
+ os.getenv("SPACE_ID") is not None or
547
+ os.getenv("SPACE_HOST") is not None
548
+ )
549
 
550
  # Check for space environment variables
551
  space_host = os.getenv("SPACE_HOST")
 
553
 
554
  if space_host:
555
  logger.info(f"✅ SPACE_HOST found: {space_host}")
556
+ logger.info(f" Runtime URL: https://{space_host}")
557
  else:
558
  logger.info("ℹ️ SPACE_HOST environment variable not found (running locally?).")
559
 
 
563
  else:
564
  logger.info("ℹ️ SPACE_ID environment variable not found (running locally?).")
565
 
566
+ logger.info(f"🔧 Production mode: {is_production}")
567
+
568
  # Create interface
569
  interface = create_interface()
570
 
571
  # Launch configuration
 
 
 
 
 
 
 
 
572
  if is_production:
573
+ # Production settings for HuggingFace Spaces
574
+ launch_kwargs = {
575
  "server_name": "0.0.0.0",
576
  "server_port": int(os.getenv("PORT", 7860)),
577
+ "share": False,
578
+ "debug": False,
579
+ "show_error": True,
580
+ "quiet": False,
581
+ "favicon_path": None,
582
  "auth": None
583
+ }
584
+ logger.info(f"🚀 Launching in PRODUCTION mode on 0.0.0.0:{launch_kwargs['server_port']}")
585
  else:
586
  # Development settings
587
+ launch_kwargs = {
588
  "server_name": "127.0.0.1",
589
  "server_port": 7860,
590
+ "share": False,
591
+ "debug": True,
592
+ "show_error": True,
593
+ "quiet": False,
594
+ "favicon_path": None,
595
  "inbrowser": True
596
+ }
597
+ logger.info("🔧 Launching in DEVELOPMENT mode on 127.0.0.1:7860")
598
 
 
599
  interface.launch(**launch_kwargs)
600
 
601
  if __name__ == "__main__":