David Ko commited on
Commit
ceaf5b4
·
1 Parent(s): bdeb19d

Add debugging code to add_detected_objects function

Browse files
Files changed (1) hide show
  1. api.py +25 -2
api.py CHANGED
@@ -614,11 +614,34 @@ def add_detected_objects():
614
  return jsonify({"error": "Image embedding model or vector DB not available"})
615
 
616
  try:
 
 
 
617
  # 요청에서 이미지와 객체 검출 결과 데이터 추출
618
  data = request.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
 
620
- if not data or 'image' not in data or 'objects' not in data:
621
- return jsonify({"error": "Missing image or objects data"})
 
 
 
622
 
623
  # 이미지 데이터 처리
624
  image_data = data['image']
 
614
  return jsonify({"error": "Image embedding model or vector DB not available"})
615
 
616
  try:
617
+ # 디버깅: 요청 데이터 로깅
618
+ print("[DEBUG] Received request in add-detected-objects")
619
+
620
  # 요청에서 이미지와 객체 검출 결과 데이터 추출
621
  data = request.json
622
+ print(f"[DEBUG] Request data keys: {list(data.keys()) if data else 'None'}")
623
+
624
+ if not data:
625
+ print("[DEBUG] Error: No data received in request")
626
+ return jsonify({"error": "No data received"})
627
+
628
+ if 'image' not in data:
629
+ print("[DEBUG] Error: 'image' key not found in request data")
630
+ return jsonify({"error": "Missing image data"})
631
+
632
+ if 'objects' not in data:
633
+ print("[DEBUG] Error: 'objects' key not found in request data")
634
+ return jsonify({"error": "Missing objects data"})
635
+
636
+ # 이미지 데이터 디버깅
637
+ print(f"[DEBUG] Image data type: {type(data['image'])}")
638
+ print(f"[DEBUG] Image data starts with: {data['image'][:50]}...") # 처음 50자만 출력
639
 
640
+ # 객체 데이터 디버깅
641
+ print(f"[DEBUG] Objects data type: {type(data['objects'])}")
642
+ print(f"[DEBUG] Objects count: {len(data['objects']) if isinstance(data['objects'], list) else 'Not a list'}")
643
+ if isinstance(data['objects'], list) and len(data['objects']) > 0:
644
+ print(f"[DEBUG] First object keys: {list(data['objects'][0].keys()) if isinstance(data['objects'][0], dict) else 'Not a dict'}")
645
 
646
  # 이미지 데이터 처리
647
  image_data = data['image']