Spaces:
Sleeping
Sleeping
Update app.py
Browse filesFixing Batch Processing
app.py
CHANGED
@@ -200,13 +200,17 @@ def evaluate_model(labels, preds):
|
|
200 |
|
201 |
return accuracy, roc_score, report, fig, fig_roc
|
202 |
|
|
|
203 |
# Batch processing for all models
|
204 |
def process_zip(zip_file):
|
205 |
extracted_dir = extract_zip(zip_file.name)
|
206 |
|
|
|
|
|
|
|
207 |
# Run classification for each model
|
208 |
results = {}
|
209 |
-
for idx, pipe in enumerate(
|
210 |
labels, preds, images = classify_images(extracted_dir, pipe)
|
211 |
accuracy, roc_score, report, cm_fig, roc_fig = evaluate_model(labels, preds)
|
212 |
|
@@ -227,6 +231,7 @@ def process_zip(zip_file):
|
|
227 |
results['Model_2_accuracy'], results['Model_2_roc_score'], results['Model_2_report'],
|
228 |
results['Model_2_cm_fig'], results['Model_2_roc_fig'])
|
229 |
|
|
|
230 |
# Single image section
|
231 |
def load_url(url):
|
232 |
try:
|
|
|
200 |
|
201 |
return accuracy, roc_score, report, fig, fig_roc
|
202 |
|
203 |
+
# Batch processing for all models
|
204 |
# Batch processing for all models
|
205 |
def process_zip(zip_file):
|
206 |
extracted_dir = extract_zip(zip_file.name)
|
207 |
|
208 |
+
# Initialize model pipelines (instead of re-using the same pipe in each iteration)
|
209 |
+
model_pipelines = [pipe0, pipe1, pipe2]
|
210 |
+
|
211 |
# Run classification for each model
|
212 |
results = {}
|
213 |
+
for idx, pipe in enumerate(model_pipelines): # Ensure each model pipeline is used separately
|
214 |
labels, preds, images = classify_images(extracted_dir, pipe)
|
215 |
accuracy, roc_score, report, cm_fig, roc_fig = evaluate_model(labels, preds)
|
216 |
|
|
|
231 |
results['Model_2_accuracy'], results['Model_2_roc_score'], results['Model_2_report'],
|
232 |
results['Model_2_cm_fig'], results['Model_2_roc_fig'])
|
233 |
|
234 |
+
|
235 |
# Single image section
|
236 |
def load_url(url):
|
237 |
try:
|