Spaces:
Paused
Paused
| #!/usr/bin/env python3 | |
| """Test script to verify all imports work correctly""" | |
| import sys | |
| import importlib | |
| def test_imports(): | |
| """Test that all required modules can be imported""" | |
| modules_to_test = [ | |
| # External dependencies | |
| ('gradio', 'Gradio UI framework'), | |
| ('torch', 'PyTorch'), | |
| ('transformers', 'Transformers library'), | |
| ('diffusers', 'Diffusers library'), | |
| ('PIL', 'Pillow image library'), | |
| ('numpy', 'NumPy'), | |
| ('trimesh', 'Trimesh 3D library'), | |
| # Internal modules | |
| ('core.ai_pipeline', 'AI Pipeline'), | |
| ('core.game_mechanics', 'Game Mechanics'), | |
| ('core.state_manager', 'State Manager'), | |
| ('core.auth_manager', 'Auth Manager'), | |
| ('models.stt_processor', 'STT Processor'), | |
| ('models.text_generator', 'Text Generator'), | |
| ('models.image_generator', 'Image Generator'), | |
| ('models.model_3d_generator', '3D Model Generator'), | |
| ('models.rigging_processor', 'Rigging Processor'), | |
| ('ui.themes', 'UI Themes'), | |
| ('ui.interfaces', 'UI Interfaces'), | |
| ('utils.fallbacks', 'Fallback Manager'), | |
| ('utils.caching', 'Model Cache'), | |
| ] | |
| print("π Testing imports...\n") | |
| failed = [] | |
| for module_name, description in modules_to_test: | |
| try: | |
| importlib.import_module(module_name) | |
| print(f"β {description} ({module_name})") | |
| except ImportError as e: | |
| print(f"β {description} ({module_name}): {e}") | |
| failed.append((module_name, str(e))) | |
| except Exception as e: | |
| print(f"β οΈ {description} ({module_name}): Imported but with error: {e}") | |
| print("\n" + "="*50 + "\n") | |
| if failed: | |
| print(f"β {len(failed)} imports failed:") | |
| for module, error in failed: | |
| print(f" - {module}: {error}") | |
| print("\nπ‘ Install missing dependencies with: pip install -r requirements.txt") | |
| return False | |
| else: | |
| print("β All imports successful!") | |
| print("\nπ You can now run: python app.py") | |
| return True | |
| if __name__ == "__main__": | |
| success = test_imports() | |
| sys.exit(0 if success else 1) |