Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the breast cancer image classification model
|
5 |
+
model = pipeline("image-classification", model="OverDriveLee/Breast_Cancer")
|
6 |
+
|
7 |
+
# Define the prediction function
|
8 |
+
def classify_image(image):
|
9 |
+
results = model(image)
|
10 |
+
return {"prediction": results[0]["label"], "confidence": results[0]["score"]}
|
11 |
+
|
12 |
+
# Define the Gradio interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=classify_image,
|
15 |
+
inputs=gr.inputs.Image(),
|
16 |
+
outputs="json",
|
17 |
+
title="Breast Cancer Image Classification",
|
18 |
+
description="This application classifies breast cancer images into different classes."
|
19 |
+
)
|
20 |
+
|
21 |
+
# Launch the Gradio interface
|
22 |
+
if __name__ == "__main__":
|
23 |
+
iface.launch()
|