Spaces:
Runtime error
Runtime error
File size: 1,510 Bytes
4ce59af dfea2de 72e8105 dfea2de 72e8105 dfea2de 72e8105 dfea2de 4ce59af dfea2de 72e8105 dfea2de 72e8105 dfea2de 72e8105 dfea2de 72e8105 dfea2de 72e8105 dfea2de cd5b9cf 72e8105 cd5b9cf e4acaca cd5b9cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import torch.nn as nn
# ================================
# 🧠 MODEL CLASSES
# ================================
class BrainTumorModel(nn.Module):
def __init__(self):
super().__init__()
self.model = nn.Sequential(
nn.Conv2d(3, 16, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(16, 32, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Flatten(),
nn.Linear(32 * 56 * 56, 128),
nn.ReLU(),
nn.Linear(128, 4)
)
def forward(self, x):
return self.model(x)
class GliomaStageModel(nn.Module):
def __init__(self):
super().__init__()
self.model = nn.Sequential(
nn.Conv2d(3, 16, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(16, 32, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Flatten(),
nn.Linear(32 * 56 * 56, 128),
nn.ReLU(),
nn.Linear(128, 4)
)
def forward(self, x):
return self.model(x)
def get_precautions_from_gemini(tumor_type: str) -> str:
db = {
"meningioma": "Avoid radiation exposure and get regular check‑ups.",
"pituitary": "Monitor hormonal levels and follow medication strictly.",
"notumor": "Stay healthy and get annual MRI scans if symptoms appear."
}
return db.get(tumor_type.lower(), "No specific precautions found.")
|