thangvip's picture
fix: declare ZeroGPU capability and launch Space
2e777ff verified
Raw
History Blame
675 Bytes
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:
@staticmethod
def GPU(*_args, **_kwargs):
return lambda function: function
spaces = _Spaces()
from compliment_forest.server import create_app
@spaces.GPU(duration=1)
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)