Spaces:
Runtime error
Runtime error
Update app.py
Browse files43 unmodified lines4445464748474849505152545553545556575859616061626343 unmodified lines if min_probability < 70: # Adjust the threshold as needed result_str = "Can't detect this image. Please try another one." history.append(result_str) return None, None, history return None, None, result_str
best_model = max(all_predictions, key=all_predictions.get) class_name = class_folders[np.argmax(models[best_model].predict(img)[0])] probability = all_predictions[best_model]
result_str = f"{best_model}: {class_name} {probability}%" history.append(result_str) # result_str = f"{best_model}: {class_name} {probability}%" # result_str.append(result_str)
return class_name, probability, None
except Exception as e: error_message = f"Error: {str(e)}" return None, None, None return None, None, error_message
image_input = gr.Image(type='filepath', label="Input Image")model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")app.py+4-5