OpelSpeedster commited on
Commit
fc99787
·
verified ·
1 Parent(s): 2b01ef0

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -0
  2. server/wildfire_environment.py +7 -3
Dockerfile CHANGED
@@ -14,4 +14,5 @@ RUN pip install --no-cache-dir -e .
14
 
15
  EXPOSE 8000
16
 
 
17
  CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
14
 
15
  EXPOSE 8000
16
 
17
+ ENV ENABLE_WEB_INTERFACE=true
18
  CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
server/wildfire_environment.py CHANGED
@@ -12,6 +12,7 @@ This environment uses the FirenetCNN model for wildfire detection.
12
 
13
  import os
14
  import base64
 
15
  from uuid import uuid4
16
  from io import BytesIO
17
 
@@ -89,9 +90,12 @@ class WildfireEnvironment(Environment):
89
  gradcam_summary=f"Grad-CAM: {obs.get('gradcam_summary', [0])[0]}",
90
  frame_id=int(obs.get("frame_id", [0])[0]),
91
  step=int(obs.get("step", [0])[0]),
92
- ground_truth=["fire", "smoke", "no_fire"][
93
- int(obs.get("ground_truth", [2])[0])
94
- ],
 
 
 
95
  reward=reward,
96
  done=done,
97
  metadata={},
 
12
 
13
  import os
14
  import base64
15
+ import numpy as np
16
  from uuid import uuid4
17
  from io import BytesIO
18
 
 
90
  gradcam_summary=f"Grad-CAM: {obs.get('gradcam_summary', [0])[0]}",
91
  frame_id=int(obs.get("frame_id", [0])[0]),
92
  step=int(obs.get("step", [0])[0]),
93
+ ground_truth_arr = obs.get("ground_truth", np.array([2]))
94
+ if hasattr(ground_truth_arr, 'ndim') and ground_truth_arr.ndim > 0:
95
+ gt_idx = int(ground_truth_arr[0])
96
+ else:
97
+ gt_idx = int(ground_truth_arr)
98
+ ground_truth=["fire", "smoke", "no_fire"][gt_idx],
99
  reward=reward,
100
  done=done,
101
  metadata={},