import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from openenv.core.env_server import create_fastapi_app from env import CodeReviewEnv from models import Action, Observation # Create the FastAPI app app = create_fastapi_app(CodeReviewEnv, Action, Observation) @app.on_event("startup") def startup_event(): # Run the continuous inference/benchmark in the background # This ensures logs appear in the console while the server stays alive import threading from inference import run_inference print("🚀 Auto-starting inference engine...", flush=True) threading.Thread(target=run_inference, daemon=True).start() def main(): import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000) if __name__ == "__main__": main()