cadforge / server /app.py
eventhorizon28's picture
Upload folder using huggingface_hub
4795be7 verified
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
try:
from openenv.core.env_server.http_server import create_app
from openenv.core.env_server.types import ConcurrencyConfig
except Exception as e:
raise ImportError(
"openenv is required for the web interface. Install dependencies with '\n uv sync\n'"
) from e
try:
from ..models import CadforgeAction, CadforgeObservation
from .cadforge_environment import CadforgeEnvironment
except (ImportError, ValueError):
from models import CadforgeAction, CadforgeObservation
from server.cadforge_environment import CadforgeEnvironment
app = create_app(
CadforgeEnvironment,
CadforgeAction,
CadforgeObservation,
env_name="cadforge",
concurrency_config=ConcurrencyConfig(
max_concurrent_envs=20,
session_timeout=300,
),
)
def main(host: str = "0.0.0.0", port: int = 8000):
import uvicorn
uvicorn.run(app, host=host, port=port)
if __name__ == "__main__":
main()