Spaces:
Sleeping
Sleeping
| # 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. | |
| """FastAPI application for the Compiler Pass Ordering Environment.""" | |
| try: | |
| from openenv.core.env_server.http_server import create_app | |
| except Exception as e: | |
| raise ImportError( | |
| "openenv is required. Install with: pip install -e ." | |
| ) from e | |
| try: | |
| from ..models import CompilerOptAction, CompilerOptObservation | |
| from .compiler_opt_env_environment import CompilerOptEnvironment | |
| except (ImportError, ModuleNotFoundError): | |
| from models import CompilerOptAction, CompilerOptObservation | |
| from server.compiler_opt_env_environment import CompilerOptEnvironment | |
| app = create_app( | |
| CompilerOptEnvironment, | |
| CompilerOptAction, | |
| CompilerOptObservation, | |
| env_name="compiler_opt_env", | |
| max_concurrent_envs=1, | |
| ) | |
| def main(): | |
| import uvicorn | |
| # Use standard host/port for the validator | |
| uvicorn.run(app, host="0.0.0.0", port=8000) | |
| if __name__ == "__main__": | |
| main() | |