|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
Hugging Face Space launcher for MatrixGame WebSocket Server |
|
|
This script launches the server with the appropriate configuration for Hugging Face Spaces. |
|
|
""" |
|
|
|
|
|
import os |
|
|
import sys |
|
|
import subprocess |
|
|
|
|
|
def main(): |
|
|
|
|
|
port = int(os.environ.get("PORT", 7860)) |
|
|
|
|
|
|
|
|
is_hf_space = os.environ.get("SPACE_ID") is not None |
|
|
|
|
|
|
|
|
path_arg = "" |
|
|
if is_hf_space: |
|
|
|
|
|
path_arg = f"--path /{os.environ.get('SPACE_ID', '')}" |
|
|
|
|
|
|
|
|
cmd = f"{sys.executable} server.py --host 0.0.0.0 --port {port} {path_arg}" |
|
|
print(f"Running command: {cmd}") |
|
|
subprocess.run(cmd, shell=True) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |