LPX commited on
Commit
b6b6807
·
1 Parent(s): 67f3560

🐛 fix(image):

Browse files

- correct typo in 'ViT-base Classifer' to 'ViT-base Classifier'
- rename model_3 and model_4 feature extractor variable names for uniformity

change the redundant print pattern for debug in model images wiith feature extractor in predict api

feature_extractor_3 to model_3 in 【GD LOVE】 function monitor for bug excess unexpected error output

feature_extractor_4 to model_4

map header value variables for neural networking endoument pattern fix

Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -84,6 +84,7 @@ def predict_with_model(img_pil, clf, class_names, confidence_threshold, model_na
84
  return label, result_output
85
 
86
  @spaces.GPU(duration=10)
 
87
  def predict_image(img, confidence_threshold):
88
  if not isinstance(img, Image.Image):
89
  raise ValueError(f"Expected a PIL Image, but got {type(img)}")
@@ -95,9 +96,9 @@ def predict_image(img, confidence_threshold):
95
  img_pilvits = transforms.Resize((224, 224))(img_pil)
96
 
97
  label_1, result_1output = predict_with_model(img_pil, clf_1, CLASS_NAMES["model_1"], confidence_threshold, "SwinV2-base", 1)
98
- label_2, result_2output = predict_with_model(img_pilvits, clf_2, CLASS_NAMES["model_2"], confidence_threshold, "ViT-base Classifer", 2)
99
- label_3, result_3output = predict_with_model(img_pil, feature_extractor_3, model_3, CLASS_NAMES["model_3"], confidence_threshold, "SDXL-Trained", 3)
100
- label_4, result_4output = predict_with_model(img_pil, feature_extractor_4, model_4, CLASS_NAMES["model_4"], confidence_threshold, "SDXL + FLUX", 4)
101
  label_5, result_5output = predict_with_model(img_pilvits, clf_5, CLASS_NAMES["model_5"], confidence_threshold, "ViT-base Newcomer", 5)
102
  label_5b, result_5boutput = predict_with_model(img_pilvits, clf_5b, CLASS_NAMES["model_5b"], confidence_threshold, "ViT-base Newcomer", 6)
103
 
@@ -109,12 +110,10 @@ def predict_image(img, confidence_threshold):
109
  "prithivMLmods": label_5,
110
  "prithivMLmods-2-22": label_5b
111
  }
112
- print(combined_results)
113
 
114
  combined_outputs = [result_1output, result_2output, result_3output, result_4output, result_5output, result_5boutput]
115
  return img_pil, combined_outputs
116
 
117
-
118
  # Define a function to generate the HTML content
119
  # Define a function to generate the HTML content
120
  def generate_results_html(results):
 
84
  return label, result_output
85
 
86
  @spaces.GPU(duration=10)
87
+ # app.py
88
  def predict_image(img, confidence_threshold):
89
  if not isinstance(img, Image.Image):
90
  raise ValueError(f"Expected a PIL Image, but got {type(img)}")
 
96
  img_pilvits = transforms.Resize((224, 224))(img_pil)
97
 
98
  label_1, result_1output = predict_with_model(img_pil, clf_1, CLASS_NAMES["model_1"], confidence_threshold, "SwinV2-base", 1)
99
+ label_2, result_2output = predict_with_model(img_pilvits, clf_2, CLASS_NAMES["model_2"], confidence_threshold, "ViT-base Classifier", 2)
100
+ label_3, result_3output = predict_with_model(img_pil, model_3, CLASS_NAMES["model_3"], confidence_threshold, "SDXL-Trained", 3)
101
+ label_4, result_4output = predict_with_model(img_pil, model_4, CLASS_NAMES["model_4"], confidence_threshold, "SDXL + FLUX", 4)
102
  label_5, result_5output = predict_with_model(img_pilvits, clf_5, CLASS_NAMES["model_5"], confidence_threshold, "ViT-base Newcomer", 5)
103
  label_5b, result_5boutput = predict_with_model(img_pilvits, clf_5b, CLASS_NAMES["model_5b"], confidence_threshold, "ViT-base Newcomer", 6)
104
 
 
110
  "prithivMLmods": label_5,
111
  "prithivMLmods-2-22": label_5b
112
  }
 
113
 
114
  combined_outputs = [result_1output, result_2output, result_3output, result_4output, result_5output, result_5boutput]
115
  return img_pil, combined_outputs
116
 
 
117
  # Define a function to generate the HTML content
118
  # Define a function to generate the HTML content
119
  def generate_results_html(results):