Spaces:
Sleeping
Sleeping
File size: 1,087 Bytes
16f1328 8c75600 16f1328 bf9c466 16f1328 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | """FastAPI application for the LeanMigrate OpenEnv environment."""
from __future__ import annotations
import argparse
try:
from openenv.core.env_server.http_server import create_app
except Exception as error: # pragma: no cover
raise ImportError(
"openenv-core is required for the web interface. Run `uv sync` first."
) from error
from ..env.models import LeanMigrateAction, LeanMigrateObservation
from .lean_migrate_environment import LeanMigrateEnvironment
app = create_app(
LeanMigrateEnvironment,
LeanMigrateAction,
LeanMigrateObservation,
env_name="lean_migrate",
# Allow concurrent sessions — LeanMigrateEnvironment is stateless per episode.
max_concurrent_envs=8,
)
def main(host: str = "0.0.0.0", port: int = 8000) -> None:
import uvicorn
uvicorn.run(app, host=host, port=port)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=8000)
args = parser.parse_args()
if args.port == 8000:
main()
else:
main(port=args.port)
|