Spaces:
Runtime error
Runtime error
Update app.py
Browse files41 unmodified lines42434445464747484950512 unmodified lines545556565758596041 unmodified lines min_probability = min(all_predictions.values())
if min_probability < 70: # Adjust the threshold as needed history=[] result_str = "Can't detect this image. Please try another one." history.append(result_str) return None, None, history[-3:-1] return None, None, history
best_model = max(all_predictions, key=all_predictions.get) class_name = class_folders[np.argmax(models[best_model].predict(img)[0])]2 unmodified lines result_str = f"{best_model}: {class_name} {probability}%" history.append(result_str)
return class_name, probability, history[-3:-1] return class_name, probability, history[-1],
except Exception as e: error_message = f"Error: {str(e)}"app.py+3-2