LPX55 commited on
Commit
268b7e1
·
verified ·
1 Parent(s): 3f5a709

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -64,7 +64,7 @@ def predict_image(img, confidence_threshold):
64
  try:
65
  prediction_1 = clf_1(img_pil)
66
  result_1 = {pred['label']: pred['score'] for pred in prediction_1}
67
-
68
  # Ensure the result dictionary contains all class names
69
  for class_name in class_names_1:
70
  if class_name not in result_1:
@@ -84,7 +84,7 @@ def predict_image(img, confidence_threshold):
84
  try:
85
  prediction_2 = clf_2(img_pil)
86
  result_2 = {pred['label']: pred['score'] for pred in prediction_2}
87
-
88
  # Ensure the result dictionary contains all class names
89
  for class_name in class_names_2:
90
  if class_name not in result_2:
@@ -107,12 +107,12 @@ def predict_image(img, confidence_threshold):
107
  outputs_3 = model_3(**inputs_3)
108
  logits_3 = outputs_3.logits
109
  probabilities_3 = softmax(logits_3.cpu().numpy()[0])
110
-
111
  result_3 = {
112
  labels_3[0]: float(probabilities_3[0]), # AI
113
  labels_3[1]: float(probabilities_3[1]) # Real
114
  }
115
-
116
  # Ensure the result dictionary contains all class names
117
  for class_name in labels_3:
118
  if class_name not in result_3:
@@ -140,7 +140,7 @@ def predict_image(img, confidence_threshold):
140
  labels_4[0]: float(probabilities_4[0]), # AI
141
  labels_4[1]: float(probabilities_4[1]) # Real
142
  }
143
-
144
  # Ensure the result dictionary contains all class names
145
  for class_name in labels_4:
146
  if class_name not in result_4:
 
64
  try:
65
  prediction_1 = clf_1(img_pil)
66
  result_1 = {pred['label']: pred['score'] for pred in prediction_1}
67
+ print(result_1)
68
  # Ensure the result dictionary contains all class names
69
  for class_name in class_names_1:
70
  if class_name not in result_1:
 
84
  try:
85
  prediction_2 = clf_2(img_pil)
86
  result_2 = {pred['label']: pred['score'] for pred in prediction_2}
87
+ print(result_2)
88
  # Ensure the result dictionary contains all class names
89
  for class_name in class_names_2:
90
  if class_name not in result_2:
 
107
  outputs_3 = model_3(**inputs_3)
108
  logits_3 = outputs_3.logits
109
  probabilities_3 = softmax(logits_3.cpu().numpy()[0])
110
+
111
  result_3 = {
112
  labels_3[0]: float(probabilities_3[0]), # AI
113
  labels_3[1]: float(probabilities_3[1]) # Real
114
  }
115
+ print(result_3)
116
  # Ensure the result dictionary contains all class names
117
  for class_name in labels_3:
118
  if class_name not in result_3:
 
140
  labels_4[0]: float(probabilities_4[0]), # AI
141
  labels_4[1]: float(probabilities_4[1]) # Real
142
  }
143
+ print(result_4)
144
  # Ensure the result dictionary contains all class names
145
  for class_name in labels_4:
146
  if class_name not in result_4: