Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	| # FastAPI Lifespan Fix for app.py | |
| # Replace the problematic lifespan setup with proper FastAPI configuration | |
| # The issue is on line 502: app.router.lifespan_context = lifespan | |
| # This should be replaced with proper FastAPI app initialization | |
| # Correct way for FastAPI 0.104.1: | |
| from contextlib import asynccontextmanager | |
| from fastapi import FastAPI | |
| async def lifespan(app: FastAPI): | |
| # Startup | |
| success = omni_api.load_model() | |
| if not success: | |
| logger.warning("⚠️ OmniAvatar model loading failed - running in limited mode") | |
| # Load TTS models | |
| try: | |
| await omni_api.tts_manager.load_models() | |
| logger.info("✅ TTS models initialization completed") | |
| except Exception as e: | |
| logger.error(f"❌ TTS initialization failed: {e}") | |
| yield | |
| # Shutdown (if needed) | |
| logger.info("Application shutting down...") | |
| # Create FastAPI app WITH lifespan parameter | |
| app = FastAPI( | |
| title="OmniAvatar-14B API with Advanced TTS", | |
| version="1.0.0", | |
| lifespan=lifespan | |
| ) | |
| # Remove the problematic line: app.router.lifespan_context = lifespan | |
