Fernandosr85 commited on
Commit
2cd249e
Β·
verified Β·
1 Parent(s): 3dbf05e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -956,20 +956,36 @@ def launch_dual_mode():
956
  # 8. MAIN APPLICATION FUNCTIONS
957
  # ============================================================================
958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
  def create_app():
960
  """Create the main application instance"""
961
  print("🌐 Creating InclusiveEdu application...")
962
 
963
  try:
964
  # Initialize components
965
- initialize_global_instances()
966
 
967
  # Create Gradio interface
968
  gradio_interface = GradioInterface()
969
  interface = gradio_interface.create_interface()
970
 
971
  print("βœ… Application created successfully!")
972
- print(f"πŸ”§ AI Status: {'Model Active' if not global_ai_config.simulation_mode else 'Enhanced Simulation'}")
973
  print(f"πŸ–₯️ Device: {'GPU' if torch.cuda.is_available() else 'CPU'}")
974
  print(f"πŸ“Š Profiles: 4 neurodiverse learning profiles available")
975
  print(f"πŸ”Œ API: Integrated FastAPI endpoints")
 
956
  # 8. MAIN APPLICATION FUNCTIONS
957
  # ============================================================================
958
 
959
+ # Global instances
960
+ global_ai_config = None
961
+ global_pipeline = None
962
+
963
+ def initialize_global_instances():
964
+ """Initialize global instances for API and Gradio"""
965
+ global global_ai_config, global_pipeline
966
+
967
+ if global_ai_config is None:
968
+ print("πŸ”§ Initializing global AI config...")
969
+ global_ai_config = AIConfig(safe_mode=True)
970
+ global_pipeline = ContentAdaptationPipeline(global_ai_config)
971
+ print("βœ… Global instances initialized!")
972
+
973
+ return global_ai_config, global_pipeline
974
+
975
  def create_app():
976
  """Create the main application instance"""
977
  print("🌐 Creating InclusiveEdu application...")
978
 
979
  try:
980
  # Initialize components
981
+ ai_config, pipeline = initialize_global_instances()
982
 
983
  # Create Gradio interface
984
  gradio_interface = GradioInterface()
985
  interface = gradio_interface.create_interface()
986
 
987
  print("βœ… Application created successfully!")
988
+ print(f"πŸ”§ AI Status: {'Model Active' if not ai_config.simulation_mode else 'Enhanced Simulation'}")
989
  print(f"πŸ–₯️ Device: {'GPU' if torch.cuda.is_available() else 'CPU'}")
990
  print(f"πŸ“Š Profiles: 4 neurodiverse learning profiles available")
991
  print(f"πŸ”Œ API: Integrated FastAPI endpoints")