Spaces:
Runtime error
Runtime error
Update app.py
Browse files38 unmodified lines394041424344454647484950515253545556575859606162636465666768697071727338 unmodified linesprobability = round(max(predictions[0]) * 100, 2)history.append(f"Predicted Class: {class_name}\nProbability: {probability}%\nModel: {model_name}\n")return class_name, probability ,historyexcept Exception as e:history.append(f"Error: {str(e)}")return "Error", None, Nonedef export_results(class_name, probability, model_name):result_str = f"Predicted Class: {class_name}\nProbability: {probability}%\nModel: {model_name}"history.append(result_str)result_label.value = "\n".join(history)image_input = gr.Image(type='filepath', label="Input Image")model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")iface = gr.Interface(fn=classify_selected_model,inputs=[image_input, model_dropdown],outputs=[gr.Label(value="Archaeological Site"),gr.Label(value="Probability"),gr.Label(value="Exported Result")],examples=[["Sites/Ajloun.png"],["Sites/Jeresh.png"],38 unmodified lines3940414243444546474849505152535455565758596061626364656638 unmodified linesprobability = round(max(predictions[0]) * 100, 2)result_str = f"Predicted Class: {class_name}\nProbability: {probability}%\nModel: {model_name}"history.append(result_str)return class_name, probability, result_strexcept Exception as e:error_message = f"Error: {str(e)}"history.append(error_message)return "Error", None, error_messageimage_input = gr.Image(type='filepath', label="Input Image")model_dropdown = gr.Dropdown(["ResNet", "EfficientNet", "VGGNet", "InceptionV3"], label="Select Model")result_label = gr.Label(value="Exported Result")iface = gr.Interface(fn=classify_selected_model,inputs=[image_input, model_dropdown ,],outputs=[gr.Label(value="Archaeological Site"),gr.Label(value="Probability"),result_label],examples=[["Sites/Ajloun.png"],["Sites/Jeresh.png"],
app.py+11-18