vicliv commited on
Commit
cde6e53
Β·
1 Parent(s): c0f0f00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -121,7 +121,7 @@ def compute_prompt_match(image: Image.Image, prompt: str) -> float:
121
  return 0.0
122
 
123
  # --- Main prediction logic ---
124
- def detect_with_model(image: Image.Image, prompt: str, username: str, model: str):
125
  if not username.strip():
126
  return "Please enter your name.", None, [], gr.update(visible=True), gr.update(visible=False), username
127
 
@@ -144,11 +144,11 @@ def detect_with_model(image: Image.Image, prompt: str, username: str, model: str
144
  score = 1 if prediction == "Real" else 0
145
 
146
  message = f"πŸ” Prediction: {prediction} ({confidence}% confidence)\n🧐 Prompt match: {round(prompt_score, 2)}%"
147
- if prediction == "Real" and model.lower() != "real":
148
  leaderboard_scores[username] = leaderboard_scores.get(username, 0) + score
149
  message += "\nπŸŽ‰ Nice! You fooled the AI. +1 point!"
150
  else:
151
- if model.lower() == "real":
152
  message += "\n You uploaded a real image, this does not count toward the leaderboard!"
153
  else:
154
  message += "\nπŸ˜… The AI caught you this time. Try again!"
 
121
  return 0.0
122
 
123
  # --- Main prediction logic ---
124
+ def detect_with_model(image: Image.Image, prompt: str, username: str, model_name: str):
125
  if not username.strip():
126
  return "Please enter your name.", None, [], gr.update(visible=True), gr.update(visible=False), username
127
 
 
144
  score = 1 if prediction == "Real" else 0
145
 
146
  message = f"πŸ” Prediction: {prediction} ({confidence}% confidence)\n🧐 Prompt match: {round(prompt_score, 2)}%"
147
+ if prediction == "Real" and model_name.lower() != "real":
148
  leaderboard_scores[username] = leaderboard_scores.get(username, 0) + score
149
  message += "\nπŸŽ‰ Nice! You fooled the AI. +1 point!"
150
  else:
151
+ if model_name.lower() == "real":
152
  message += "\n You uploaded a real image, this does not count toward the leaderboard!"
153
  else:
154
  message += "\nπŸ˜… The AI caught you this time. Try again!"