Pream912 commited on
Commit
aed5eeb
·
verified ·
1 Parent(s): 785c226

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -18,7 +18,10 @@ import numpy as np
18
  from flask import Flask, Response, jsonify, render_template_string, request
19
  from PIL import Image
20
 
21
- from wall_pipeline import WallPipeline, _GPU
 
 
 
22
 
23
  app = Flask(__name__)
24
 
@@ -256,6 +259,11 @@ def result():
256
  "rooms" : rooms,
257
  "calibration": sess.get("calibration", {}),
258
  "gpu" : _GPU,
 
 
 
 
 
259
  })
260
 
261
 
@@ -804,8 +812,18 @@ async function loadResult(){
804
 
805
  // GPU badge
806
  const badge = document.getElementById('gpu-badge');
807
- badge.textContent = d.gpu ? 'GPU ⚡' : 'CPU';
808
- badge.className = 'gpu-badge'+(d.gpu?' on':'');
 
 
 
 
 
 
 
 
 
 
809
 
810
  showMainImg('data:image/jpeg;base64,'+d.composite);
811
  if(d.wall_mask) document.getElementById('walls-img').src='data:image/jpeg;base64,'+d.wall_mask;
@@ -1089,7 +1107,7 @@ async function exportJSON(){
1089
  if __name__ == "__main__":
1090
  print("=" * 60)
1091
  print(" Blueprint Room Extractor")
1092
- print(f" GPU acceleration: {'ON (CuPy)' if _GPU else 'OFF (CPU fallback)'}")
1093
  print(" Open: http://localhost:7860")
1094
  print("=" * 60)
1095
  app.run(host="0.0.0.0", port=7860, debug=False, threaded=True)
 
18
  from flask import Flask, Response, jsonify, render_template_string, request
19
  from PIL import Image
20
 
21
+ from wall_pipeline import WallPipeline, _CUPY, _TORCH_CUDA, _CV_CUDA
22
+
23
+ # Unified "any GPU active" flag for the UI badge
24
+ _GPU = _CUPY or _TORCH_CUDA or _CV_CUDA
25
 
26
  app = Flask(__name__)
27
 
 
259
  "rooms" : rooms,
260
  "calibration": sess.get("calibration", {}),
261
  "gpu" : _GPU,
262
+ "gpu_detail" : {
263
+ "cupy" : _CUPY,
264
+ "torch_cuda" : _TORCH_CUDA,
265
+ "opencv_cuda" : _CV_CUDA,
266
+ },
267
  })
268
 
269
 
 
812
 
813
  // GPU badge
814
  const badge = document.getElementById('gpu-badge');
815
+ const gd = d.gpu_detail || {};
816
+ const layers = [];
817
+ if (gd.cupy) layers.push('CuPy');
818
+ if (gd.torch_cuda) layers.push('Torch');
819
+ if (gd.opencv_cuda) layers.push('cv2');
820
+ if (layers.length) {
821
+ badge.textContent = '⚡ GPU: ' + layers.join('+');
822
+ badge.className = 'gpu-badge on';
823
+ } else {
824
+ badge.textContent = 'CPU only';
825
+ badge.className = 'gpu-badge';
826
+ }
827
 
828
  showMainImg('data:image/jpeg;base64,'+d.composite);
829
  if(d.wall_mask) document.getElementById('walls-img').src='data:image/jpeg;base64,'+d.wall_mask;
 
1107
  if __name__ == "__main__":
1108
  print("=" * 60)
1109
  print(" Blueprint Room Extractor")
1110
+ print(f" GPU: CuPy={_CUPY} PyTorch-CUDA={_TORCH_CUDA} OpenCV-CUDA={_CV_CUDA}")
1111
  print(" Open: http://localhost:7860")
1112
  print("=" * 60)
1113
  app.run(host="0.0.0.0", port=7860, debug=False, threaded=True)