Michael Yeung commited on
Commit
59e1cca
·
1 Parent(s): 3a047d9

debug: add model diagnostics to health endpoint

Browse files
Files changed (1) hide show
  1. ocr_server.py +8 -1
ocr_server.py CHANGED
@@ -318,6 +318,9 @@ def dataset_count():
318
  @app.route('/', methods=['GET'])
319
  def health():
320
  count = _get_dataset_count()
 
 
 
321
  return jsonify({
322
  'ok': True,
323
  'engine': 'custom_onnx+ddddocr',
@@ -325,7 +328,11 @@ def health():
325
  'mode': 'hybrid',
326
  'strategies': 8,
327
  'dataset_samples': count,
328
- 'persistent': bool(hf_api)
 
 
 
 
329
  })
330
 
331
 
 
318
  @app.route('/', methods=['GET'])
319
  def health():
320
  count = _get_dataset_count()
321
+ model_size = -1
322
+ if os.path.exists(MODEL_PATH):
323
+ model_size = os.path.getsize(MODEL_PATH)
324
  return jsonify({
325
  'ok': True,
326
  'engine': 'custom_onnx+ddddocr',
 
328
  'mode': 'hybrid',
329
  'strategies': 8,
330
  'dataset_samples': count,
331
+ 'persistent': bool(hf_api),
332
+ 'ort_available': ort is not None,
333
+ 'model_path': MODEL_PATH,
334
+ 'model_exists': os.path.exists(MODEL_PATH),
335
+ 'model_size': model_size
336
  })
337
 
338