Richard Young Claude commited on
Commit
cb8e322
·
1 Parent(s): 19f4734

Fix 'too many values to unpack' in detect steganography

Browse files

- analyze_image returns 3 values: is_suspicious, confidence, details
- Updated unpacking to handle all 3 return values
- Fixed details formatting to properly iterate dict structure
- Show each analysis method with its confidence score
- Fixes runtime error in Detect tab

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -125,8 +125,8 @@ def detect_hidden_data(image, sensitivity):
125
  6: 'medium', 7: 'high', 8: 'high', 9: 'high', 10: 'high'}
126
  sensitivity_str = sens_map.get(sensitivity, 'medium')
127
 
128
- # Perform analysis
129
- confidence, details = rat_finder.analyze_image(image_path, sensitivity=sensitivity_str)
130
 
131
  # Generate ELA visualization
132
  ela_result = rat_finder.perform_ela_analysis(image_path)
@@ -154,8 +154,15 @@ def detect_hidden_data(image, sensitivity):
154
  🔍 **Analysis Details:**
155
  """
156
 
157
- for detail in details:
158
- result_text += f"\n• {detail}"
 
 
 
 
 
 
 
159
 
160
  result_text += f"""
161
 
 
125
  6: 'medium', 7: 'high', 8: 'high', 9: 'high', 10: 'high'}
126
  sensitivity_str = sens_map.get(sensitivity, 'medium')
127
 
128
+ # Perform analysis (returns: is_suspicious, confidence, details)
129
+ is_suspicious, confidence, details = rat_finder.analyze_image(image_path, sensitivity=sensitivity_str)
130
 
131
  # Generate ELA visualization
132
  ela_result = rat_finder.perform_ela_analysis(image_path)
 
154
  🔍 **Analysis Details:**
155
  """
156
 
157
+ # Details is a dict with analysis results
158
+ if isinstance(details, dict):
159
+ for analysis_type, analysis_result in details.items():
160
+ if isinstance(analysis_result, dict) and 'confidence' in analysis_result:
161
+ analysis_name = analysis_type.replace('_', ' ').title()
162
+ analysis_conf = analysis_result['confidence']
163
+ suspicious = analysis_result.get('suspicious', False)
164
+ indicator = "🚨" if suspicious and analysis_conf > 70 else "⚠️" if suspicious else "✓"
165
+ result_text += f"\n• **{analysis_name}:** {analysis_conf:.1f}% {indicator}"
166
 
167
  result_text += f"""
168