gov_env / server /app.py
dharunkkk's picture
Upload app.py
ada4b65 verified
raw
history blame contribute delete
917 Bytes
try:
from openenv.core.env_server.http_server import create_app
except Exception as e:
raise ImportError("openenv is required. Install: pip install openenv-core") from e
from models import GovAction, GovObservation
from server.gov_env_environment import GovEnvironment
app = create_app(
GovEnvironment,
GovAction,
GovObservation,
env_name="gov_env",
max_concurrent_envs=1,
)
try:
from tasks import task_manager
except ImportError:
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from tasks import task_manager
@app.get("/tasks")
async def get_tasks():
"""Get available tasks."""
return {"tasks": task_manager.get_seed_tasks()}
def main():
import uvicorn
import os
port = int(os.environ.get("PORT", 7860))
uvicorn.run(app, host="0.0.0.0", port=port)
if __name__ == "__main__":
main()