Yash goyal commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,6 +79,41 @@ def preprocess_image(image_bytes):
|
|
| 79 |
logger.error("Image preprocessing failed: %s", str(e))
|
| 80 |
raise
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
def generate_pdf(report_data, filepath):
|
| 83 |
c = canvas.Canvas(filepath, pagesize=A4)
|
| 84 |
width, height = A4
|
|
|
|
| 79 |
logger.error("Image preprocessing failed: %s", str(e))
|
| 80 |
raise
|
| 81 |
|
| 82 |
+
treatment_data = {
|
| 83 |
+
"Melanoma": {
|
| 84 |
+
"solution": "Consult a dermatologist immediately. Biopsy recommended.",
|
| 85 |
+
"medication": "Immunotherapy drugs (e.g., pembrolizumab), chemotherapy, surgical excision"
|
| 86 |
+
},
|
| 87 |
+
"Melanocytic nevus": {
|
| 88 |
+
"solution": "Usually benign. Monitor for changes.",
|
| 89 |
+
"medication": "None required unless removal is needed."
|
| 90 |
+
},
|
| 91 |
+
"Basal cell carcinoma": {
|
| 92 |
+
"solution": "Surgical removal or topical treatments.",
|
| 93 |
+
"medication": "Imiquimod cream, fluorouracil, vismodegib"
|
| 94 |
+
},
|
| 95 |
+
"Actinic keratosis": {
|
| 96 |
+
"solution": "Cryotherapy or topical treatments.",
|
| 97 |
+
"medication": "5-FU, diclofenac gel, imiquimod"
|
| 98 |
+
},
|
| 99 |
+
"Benign keratosis": {
|
| 100 |
+
"solution": "Usually harmless. Removal for cosmetic reasons.",
|
| 101 |
+
"medication": "Salicylic acid cream, cryotherapy."
|
| 102 |
+
},
|
| 103 |
+
"Dermatofibroma": {
|
| 104 |
+
"solution": "No treatment needed unless bothersome.",
|
| 105 |
+
"medication": "Steroid injections or minor surgery if needed."
|
| 106 |
+
},
|
| 107 |
+
"Vascular lesion": {
|
| 108 |
+
"solution": "Laser treatment or monitoring.",
|
| 109 |
+
"medication": "Topical beta blockers (e.g., timolol)"
|
| 110 |
+
},
|
| 111 |
+
"Squamous cell carcinoma": {
|
| 112 |
+
"solution": "Requires prompt medical attention. Surgery preferred.",
|
| 113 |
+
"medication": "Fluorouracil, imiquimod, radiation therapy"
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
def generate_pdf(report_data, filepath):
|
| 118 |
c = canvas.Canvas(filepath, pagesize=A4)
|
| 119 |
width, height = A4
|