| import os | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent / "src")) | |
| try: | |
| import spaces | |
| except ImportError: | |
| class _Spaces: | |
| def GPU(*_args, **_kwargs): | |
| return lambda function: function | |
| spaces = _Spaces() | |
| from compliment_forest.server import create_app | |
| def zerogpu_capability_probe() -> bool: | |
| """Declare ZeroGPU compatibility without spending quota in demo mode.""" | |
| return True | |
| app = create_app() | |
| if os.getenv("SPACE_ID"): | |
| app.launch(show_error=True) | |
| elif __name__ == "__main__": | |
| app.launch(server_name="0.0.0.0", server_port=7860) | |