nevernever69 commited on
Commit
e9e9c50
·
verified ·
1 Parent(s): fa23b7c

Upload server/app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. server/app.py +11 -9
server/app.py CHANGED
@@ -1,11 +1,5 @@
1
  """FastAPI application for the RedVeil Environment."""
2
 
3
- import sys
4
- import os
5
-
6
- # Ensure project root is on path
7
- sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
-
9
  try:
10
  from openenv.core.env_server.http_server import create_app
11
  except Exception as e:
@@ -13,8 +7,12 @@ except Exception as e:
13
  "openenv is required. Install with: pip install openenv-core[core]"
14
  ) from e
15
 
16
- from redveil.models import RedVeilAction, RedVeilObservation
17
- from redveil.server.redveil_environment import RedVeilEnvironment
 
 
 
 
18
 
19
 
20
  # Singleton: OpenEnv calls the factory on every request, so we return
@@ -41,4 +39,8 @@ def main(host: str = "0.0.0.0", port: int = 8000):
41
 
42
 
43
  if __name__ == "__main__":
44
- main()
 
 
 
 
 
1
  """FastAPI application for the RedVeil Environment."""
2
 
 
 
 
 
 
 
3
  try:
4
  from openenv.core.env_server.http_server import create_app
5
  except Exception as e:
 
7
  "openenv is required. Install with: pip install openenv-core[core]"
8
  ) from e
9
 
10
+ try:
11
+ from ..models import RedVeilAction, RedVeilObservation
12
+ from .redveil_environment import RedVeilEnvironment
13
+ except (ModuleNotFoundError, ImportError):
14
+ from models import RedVeilAction, RedVeilObservation
15
+ from server.redveil_environment import RedVeilEnvironment
16
 
17
 
18
  # Singleton: OpenEnv calls the factory on every request, so we return
 
39
 
40
 
41
  if __name__ == "__main__":
42
+ import argparse
43
+ parser = argparse.ArgumentParser()
44
+ parser.add_argument("--port", type=int, default=8000)
45
+ args = parser.parse_args()
46
+ main(port=args.port)