File size: 1,195 Bytes
8b4d6a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
FastAPI application for the Annotation QA Environment.

Wires up the environment to the OpenEnv HTTP/WebSocket server.

Usage:
    # Development (with auto-reload):
    uvicorn server.app:app --reload --host 0.0.0.0 --port 8000

    # Production:
    uvicorn server.app:app --host 0.0.0.0 --port 8000 --workers 4

    # Or run directly:
    uv run --project . server
"""

try:
    from openenv.core.env_server.http_server import create_app
except ImportError:
    # Minimal fallback for standalone testing
    from openenv.core.env_server import create_fastapi_app as create_app

from .environment import AnnotationQAEnvironment

# Import models for type registration
import sys
import os

# Add parent to path for model imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from models import AnnotationQAAction, AnnotationQAObservation

# Create the app
app = create_app(
    AnnotationQAEnvironment,
    AnnotationQAAction,
    AnnotationQAObservation,
    env_name="annotation_qa_env",
)


def main():
    """Entry point for direct execution."""
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)


if __name__ == "__main__":
    main()