Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,16 +59,25 @@ def predict(image, text_input):
|
|
| 59 |
_, prediction = torch.max(outputs, dim=1)
|
| 60 |
return prediction.item() # 1 for Malignant, 0 for Benign
|
| 61 |
|
| 62 |
-
# Enhanced UI with color-coded prediction display
|
| 63 |
with gr.Blocks(css="""
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
""") as demo:
|
| 69 |
gr.Markdown(
|
| 70 |
"""
|
| 71 |
-
# 🩺 SKIN LESION CLASSIFICATION
|
| 72 |
Upload an image of a skin lesion and provide clinical details to get a prediction of benign or malignant.
|
| 73 |
"""
|
| 74 |
)
|
|
@@ -82,8 +91,7 @@ with gr.Blocks(css="""
|
|
| 82 |
benign_output = gr.HTML("<div class='benign'>Benign</div>")
|
| 83 |
malignant_output = gr.HTML("<div class='malignant'>Malignant</div>")
|
| 84 |
gr.Markdown("## Example:")
|
| 85 |
-
example_image = gr.Image(value="skin_cancer_detection/Unknown-4.png")
|
| 86 |
-
example_text = gr.Textbox(value="consistent with resolving/involuting keratoacanthoma 67", interactive=False)
|
| 87 |
|
| 88 |
def display_prediction(image, text_input):
|
| 89 |
prediction = predict(image, text_input)
|
|
@@ -98,3 +106,4 @@ with gr.Blocks(css="""
|
|
| 98 |
demo.launch()
|
| 99 |
|
| 100 |
|
|
|
|
|
|
| 59 |
_, prediction = torch.max(outputs, dim=1)
|
| 60 |
return prediction.item() # 1 for Malignant, 0 for Benign
|
| 61 |
|
| 62 |
+
# Enhanced UI with background image and color-coded prediction display
|
| 63 |
with gr.Blocks(css="""
|
| 64 |
+
body {
|
| 65 |
+
background: url('./skin_cancer_detection/melanoma.png') no-repeat center center fixed;
|
| 66 |
+
background-size: cover;
|
| 67 |
+
}
|
| 68 |
+
.benign, .malignant {
|
| 69 |
+
background-color: white;
|
| 70 |
+
border: 1px solid lightgray;
|
| 71 |
+
padding: 10px;
|
| 72 |
+
border-radius: 5px;
|
| 73 |
+
}
|
| 74 |
+
.benign.correct, .malignant.correct {
|
| 75 |
+
background-color: lightgreen;
|
| 76 |
+
}
|
| 77 |
""") as demo:
|
| 78 |
gr.Markdown(
|
| 79 |
"""
|
| 80 |
+
# 🩺 SKIN LESION CLASSIFICATION
|
| 81 |
Upload an image of a skin lesion and provide clinical details to get a prediction of benign or malignant.
|
| 82 |
"""
|
| 83 |
)
|
|
|
|
| 91 |
benign_output = gr.HTML("<div class='benign'>Benign</div>")
|
| 92 |
malignant_output = gr.HTML("<div class='malignant'>Malignant</div>")
|
| 93 |
gr.Markdown("## Example:")
|
| 94 |
+
example_image = gr.Image(value="./skin_cancer_detection/Unknown-4.png", interactive=False)
|
|
|
|
| 95 |
|
| 96 |
def display_prediction(image, text_input):
|
| 97 |
prediction = predict(image, text_input)
|
|
|
|
| 106 |
demo.launch()
|
| 107 |
|
| 108 |
|
| 109 |
+
|