import gradio as gr from transformers import pipeline # Load the breast cancer image classification model model = pipeline("image-classification", model="OverDriveLee/Breast_Cancer") # Define the prediction function def classify_image(image): results = model(image) return {"prediction": results[0]["label"], "confidence": results[0]["score"]} # Define the Gradio interface iface = gr.Interface( fn=classify_image, inputs=gr.inputs.Image(), outputs="json", title="Breast Cancer Image Classification", description="This application classifies breast cancer images into different classes." ) # Launch the Gradio interface if __name__ == "__main__": iface.launch()