Spaces:
Sleeping
Sleeping
File size: 1,189 Bytes
7c07390 | 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 43 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
"""
FastAPI application for the Openenv Jayesh Environment.
"""
try:
from openenv.core.env_server.http_server import create_app
except Exception as e: # pragma: no cover
raise ImportError(
"openenv is required for the web interface. Install dependencies with '\n uv sync\n'"
) from e
try:
from ..models import TaskManagerAction, TaskManagerObservation
from .openenv_jayesh_environment import OpenenvJayeshEnvironment
except (ModuleNotFoundError, ImportError):
from models import TaskManagerAction, TaskManagerObservation
from server.openenv_jayesh_environment import OpenenvJayeshEnvironment
app = create_app(
OpenenvJayeshEnvironment,
TaskManagerAction,
TaskManagerObservation,
env_name="openenv_jayesh",
max_concurrent_envs=1,
)
def main(host: str = "0.0.0.0", port: int = 8000):
import uvicorn
uvicorn.run(app, host=host, port=port)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=8000)
args = parser.parse_args()
main(port=args.port)
|