Spaces:
Runtime error
Runtime error
Update app.py
Browse files43 unmodified lines44454647484950515253545556575859606162636443 unmodified linesif min_probability < 70: # Adjust the threshold as neededresult_str = "Can't detect this image. Please try another one."history.append(result_str)return None, None, historybest_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)return class_name, probability, Noneexcept Exception as e:error_message = f"Error: {str(e)}"return None, None, Noneimage_input = gr.Image(type='filepath', label="Input Image")model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")43 unmodified lines444546474849505152535455565758596061626343 unmodified linesif min_probability < 70: # Adjust the threshold as neededresult_str = "Can't detect this image. Please try another one."return None, None, result_strbest_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}%"# result_str.append(result_str)return class_name, probability, Noneexcept Exception as e:error_message = f"Error: {str(e)}"return None, None, error_messageimage_input = gr.Image(type='filepath', label="Input Image")model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")
app.py+4-5