TKM03 commited on
Commit
68c7528
·
verified ·
1 Parent(s): 439b7f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -101,8 +101,13 @@ def detect(image, confidence_threshold=0.7, detailed_analysis=False):
101
  overall_result = f"{'🚫 LIKELY FAKE' if threshold_predicted == 'Fake' else '✅ LIKELY REAL'} ({confidence_score:.1f}% Confidence)"
102
  aigen_result = f"{aigen_likelihood:.1f}% Likelihood"
103
  deepfake_result = f"{face_manipulation_likelihood:.1f}% Likelihood"
104
-
105
  # Create detailed report
 
 
 
 
 
106
  report = f"""
107
  ## Analysis Report
108
 
@@ -112,7 +117,7 @@ def detect(image, confidence_threshold=0.7, detailed_analysis=False):
112
  - **Analysis Threshold**: {confidence_threshold * 100:.0f}%
113
 
114
  {"### Detailed Feature Analysis" if detailed_analysis else ""}
115
- {"".join([f"\\n- **{k}**: {v:.1f}% Authenticity" for k, v in feature_analysis.items()]) if detailed_analysis else ""}
116
 
117
  ---
118
  *Analysis timestamp: {np.datetime64('now')}*
@@ -124,6 +129,7 @@ def detect(image, confidence_threshold=0.7, detailed_analysis=False):
124
  logger.error(f"Error during analysis: {str(e)}")
125
  raise gr.Error(f"Analysis failed: {str(e)}")
126
 
 
127
  # Enhanced UI with professional design
128
  custom_css = """
129
  .container {
 
101
  overall_result = f"{'🚫 LIKELY FAKE' if threshold_predicted == 'Fake' else '✅ LIKELY REAL'} ({confidence_score:.1f}% Confidence)"
102
  aigen_result = f"{aigen_likelihood:.1f}% Likelihood"
103
  deepfake_result = f"{face_manipulation_likelihood:.1f}% Likelihood"
104
+
105
  # Create detailed report
106
+ feature_analysis_text = ""
107
+ if detailed_analysis:
108
+ for k, v in feature_analysis.items():
109
+ feature_analysis_text += f"\n- **{k}**: {v:.1f}% Authenticity"
110
+
111
  report = f"""
112
  ## Analysis Report
113
 
 
117
  - **Analysis Threshold**: {confidence_threshold * 100:.0f}%
118
 
119
  {"### Detailed Feature Analysis" if detailed_analysis else ""}
120
+ {feature_analysis_text}
121
 
122
  ---
123
  *Analysis timestamp: {np.datetime64('now')}*
 
129
  logger.error(f"Error during analysis: {str(e)}")
130
  raise gr.Error(f"Analysis failed: {str(e)}")
131
 
132
+
133
  # Enhanced UI with professional design
134
  custom_css = """
135
  .container {