Spaces:
Sleeping
Sleeping
Fix Space runtime imports
Browse files- Dockerfile +1 -1
- evals.py +4 -1
- rewards.py +4 -1
- scenario_compiler.py +8 -3
- server/app.py +1 -1
- validators.py +4 -1
Dockerfile
CHANGED
|
@@ -25,4 +25,4 @@ ENV PYTHONPATH="/app/env:$PYTHONPATH"
|
|
| 25 |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 26 |
CMD curl -f http://localhost:8000/health || exit 1
|
| 27 |
|
| 28 |
-
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 25 |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 26 |
CMD curl -f http://localhost:8000/health || exit 1
|
| 27 |
|
| 28 |
+
CMD ["uvicorn", "CyberSecurity_OWASP.server.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
evals.py
CHANGED
|
@@ -5,7 +5,10 @@ from __future__ import annotations
|
|
| 5 |
import difflib
|
| 6 |
from typing import Iterable
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def random_policy() -> Iterable[CyberSecurityOWASPAction]:
|
|
|
|
| 5 |
import difflib
|
| 6 |
from typing import Iterable
|
| 7 |
|
| 8 |
+
try:
|
| 9 |
+
from .models import CyberSecurityOWASPAction
|
| 10 |
+
except ImportError: # pragma: no cover
|
| 11 |
+
from models import CyberSecurityOWASPAction
|
| 12 |
|
| 13 |
|
| 14 |
def random_policy() -> Iterable[CyberSecurityOWASPAction]:
|
rewards.py
CHANGED
|
@@ -2,7 +2,10 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
REWARD_KEYS = (
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
try:
|
| 6 |
+
from .models import CyberSecurityOWASPAction, CyberSecurityOWASPState
|
| 7 |
+
except ImportError: # pragma: no cover
|
| 8 |
+
from models import CyberSecurityOWASPAction, CyberSecurityOWASPState
|
| 9 |
|
| 10 |
|
| 11 |
REWARD_KEYS = (
|
scenario_compiler.py
CHANGED
|
@@ -6,9 +6,14 @@ import tempfile
|
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import Any
|
| 8 |
|
| 9 |
-
|
| 10 |
-
from .
|
| 11 |
-
from .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def compile_scenario(seed: int, split: str = "train", difficulty: int = 0) -> dict[str, Any]:
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import Any
|
| 8 |
|
| 9 |
+
try:
|
| 10 |
+
from .fixture_generator import visible_workspace_summary
|
| 11 |
+
from .policy_graph import build_invoice_policy
|
| 12 |
+
from .template_renderer import render_fastapi_basic
|
| 13 |
+
except ImportError: # pragma: no cover
|
| 14 |
+
from fixture_generator import visible_workspace_summary
|
| 15 |
+
from policy_graph import build_invoice_policy
|
| 16 |
+
from template_renderer import render_fastapi_basic
|
| 17 |
|
| 18 |
|
| 19 |
def compile_scenario(seed: int, split: str = "train", difficulty: int = 0) -> dict[str, Any]:
|
server/app.py
CHANGED
|
@@ -16,7 +16,7 @@ except Exception as e: # pragma: no cover
|
|
| 16 |
try:
|
| 17 |
from ..models import CyberSecurityOWASPAction, CyberSecurityOWASPObservation
|
| 18 |
from .CyberSecurity_OWASP_environment import CybersecurityOwaspEnvironment
|
| 19 |
-
except
|
| 20 |
from models import CyberSecurityOWASPAction, CyberSecurityOWASPObservation
|
| 21 |
from server.CyberSecurity_OWASP_environment import CybersecurityOwaspEnvironment
|
| 22 |
|
|
|
|
| 16 |
try:
|
| 17 |
from ..models import CyberSecurityOWASPAction, CyberSecurityOWASPObservation
|
| 18 |
from .CyberSecurity_OWASP_environment import CybersecurityOwaspEnvironment
|
| 19 |
+
except ImportError:
|
| 20 |
from models import CyberSecurityOWASPAction, CyberSecurityOWASPObservation
|
| 21 |
from server.CyberSecurity_OWASP_environment import CybersecurityOwaspEnvironment
|
| 22 |
|
validators.py
CHANGED
|
@@ -5,7 +5,10 @@ from __future__ import annotations
|
|
| 5 |
from pathlib import Path
|
| 6 |
from typing import Any
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
BLOCKED_PATH_MARKERS = (
|
|
|
|
| 5 |
from pathlib import Path
|
| 6 |
from typing import Any
|
| 7 |
|
| 8 |
+
try:
|
| 9 |
+
from .models import CyberSecurityOWASPAction, CyberSecurityOWASPState
|
| 10 |
+
except ImportError: # pragma: no cover
|
| 11 |
+
from models import CyberSecurityOWASPAction, CyberSecurityOWASPState
|
| 12 |
|
| 13 |
|
| 14 |
BLOCKED_PATH_MARKERS = (
|