Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,11 +38,13 @@ def detect(image, confidence_threshold=0.5):
|
|
38 |
threshold_predicted = "Fake" if confidence_fake / 100 >= confidence_threshold else "Real"
|
39 |
confidence_score = max(confidence_real, confidence_fake)
|
40 |
|
41 |
-
# Use raw probabilities for clarity
|
42 |
-
aigen_likelihood = confidence_fake # Assuming AI-Generated is synonymous with Fake
|
43 |
-
face_manipulation_likelihood = confidence_fake #
|
|
|
|
|
|
|
44 |
|
45 |
-
# Format outputs
|
46 |
overall = f"{confidence_score:.1f}% Confidence ({threshold_predicted})"
|
47 |
aigen = f"{aigen_likelihood:.1f}% (AI-Generated Content Likelihood)"
|
48 |
deepfake = f"{face_manipulation_likelihood:.1f}% (Face Manipulation Likelihood)"
|
@@ -52,7 +54,7 @@ def detect(image, confidence_threshold=0.5):
|
|
52 |
except Exception as e:
|
53 |
logger.error(f"Error during analysis: {str(e)}")
|
54 |
raise gr.Error(f"Analysis error: {str(e)}")
|
55 |
-
|
56 |
custom_css = """
|
57 |
.container {
|
58 |
max-width: 1200px;
|
|
|
38 |
threshold_predicted = "Fake" if confidence_fake / 100 >= confidence_threshold else "Real"
|
39 |
confidence_score = max(confidence_real, confidence_fake)
|
40 |
|
41 |
+
# Use raw probabilities for clarity
|
42 |
+
aigen_likelihood = confidence_fake # Assuming AI-Generated is synonymous with Fake
|
43 |
+
face_manipulation_likelihood = confidence_fake # Refine if possible
|
44 |
+
|
45 |
+
# Add diagnostic output for debugging
|
46 |
+
logger.info(f"Probabilities - Real: {confidence_real:.1f}%, Fake: {confidence_fake:.1f}%")
|
47 |
|
|
|
48 |
overall = f"{confidence_score:.1f}% Confidence ({threshold_predicted})"
|
49 |
aigen = f"{aigen_likelihood:.1f}% (AI-Generated Content Likelihood)"
|
50 |
deepfake = f"{face_manipulation_likelihood:.1f}% (Face Manipulation Likelihood)"
|
|
|
54 |
except Exception as e:
|
55 |
logger.error(f"Error during analysis: {str(e)}")
|
56 |
raise gr.Error(f"Analysis error: {str(e)}")
|
57 |
+
|
58 |
custom_css = """
|
59 |
.container {
|
60 |
max-width: 1200px;
|