File size: 906 Bytes
084325c 91a0291 084325c 91a0291 | 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 | import os
try:
from openenv.core.env_server.http_server import create_app
except ImportError as e:
raise ImportError("openenv is required for the web interface.") from e
# Ensure relative imports resolve correctly based on execution context
try:
from models import CustomerSupportAction, CustomerSupportObservation
except ImportError:
from ..models import CustomerSupportAction, CustomerSupportObservation
from .environment import CustomerSupportEnvironment
MAX_CONCURRENT_ENVS = int(os.getenv("MAX_CONCURRENT_ENVS", "100"))
app = create_app(
CustomerSupportEnvironment,
CustomerSupportAction,
CustomerSupportObservation,
env_name="customer_support",
max_concurrent_envs=MAX_CONCURRENT_ENVS,
)
def main(host: str = "0.0.0.0", port: int = 8000):
import uvicorn
uvicorn.run("server.app:app", host=host, port=int(port))
if __name__ == "__main__":
main()
|