Spaces:
Runtime error
Runtime error
Update app.py
Browse files14 unmodified lines151617181819202120 unmodified lines42434445454647485 unmodified lines54555657575859606161626364656566676814 unmodified linesResNet_model = load_model(ResNet_path)Efficient_model = load_model(EfficientNet_path)
history=[]
def classify_selected_model(image, model_name): try:20 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, history5 unmodified lines result_str = f"{best_model}: {class_name} {probability}%" history.append(result_str)
return class_name, probability, history[-1], return class_name, probability, None
except Exception as e: error_message = f"Error: {str(e)}" return None, None, [error_message] return None, None, None
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")result_textbox = gr.Textbox("Error ", label="Error Message")
iface = gr.Interface( fn=classify_selected_model,app.py+5-5