Spaces:
Runtime error
Runtime error
Update app.py
Browse files14 unmodified lines1516171819202120 unmodified lines424344454647485 unmodified lines54555657585960616263646566676814 unmodified linesResNet_model = load_model(ResNet_path)Efficient_model = load_model(EfficientNet_path)history=[]def classify_selected_model(image, model_name):try:20 unmodified linesmin_probability = min(all_predictions.values())if min_probability < 70: # Adjust the threshold as neededhistory=[]result_str = "Can't detect this image. Please try another one."history.append(result_str)return None, None, history5 unmodified linesresult_str = f"{best_model}: {class_name} {probability}%"history.append(result_str)return class_name, probability, history[-1],except Exception as e:error_message = f"Error: {str(e)}"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")result_textbox = gr.Textbox("Results", label="History Results")iface = gr.Interface(fn=classify_selected_model,14 unmodified lines1516171819202120 unmodified lines424344454647485 unmodified lines54555657585960616263646566676814 unmodified linesResNet_model = load_model(ResNet_path)Efficient_model = load_model(EfficientNet_path)def classify_selected_model(image, model_name):try:20 unmodified linesmin_probability = min(all_predictions.values())if 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, history5 unmodified linesresult_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")result_textbox = gr.Textbox("Error ", label="Error Message")iface = gr.Interface(fn=classify_selected_model,
app.py+5-5