Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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")
|