Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -6,18 +6,18 @@ import torch.nn as nn
|
|
6 |
|
7 |
class BrainTumorModel(nn.Module):
|
8 |
def __init__(self):
|
9 |
-
super(
|
10 |
self.model = nn.Sequential(
|
11 |
-
nn.Conv2d(3, 16,
|
12 |
nn.ReLU(),
|
13 |
nn.MaxPool2d(2),
|
14 |
-
nn.Conv2d(16, 32,
|
15 |
nn.ReLU(),
|
16 |
nn.MaxPool2d(2),
|
17 |
nn.Flatten(),
|
18 |
nn.Linear(32 * 56 * 56, 128),
|
19 |
nn.ReLU(),
|
20 |
-
nn.Linear(128, 4)
|
21 |
)
|
22 |
|
23 |
def forward(self, x):
|
@@ -25,18 +25,18 @@ class BrainTumorModel(nn.Module):
|
|
25 |
|
26 |
class GliomaStageModel(nn.Module):
|
27 |
def __init__(self):
|
28 |
-
super(
|
29 |
self.model = nn.Sequential(
|
30 |
-
nn.Conv2d(3, 16,
|
31 |
nn.ReLU(),
|
32 |
nn.MaxPool2d(2),
|
33 |
-
nn.Conv2d(16, 32,
|
34 |
nn.ReLU(),
|
35 |
nn.MaxPool2d(2),
|
36 |
nn.Flatten(),
|
37 |
nn.Linear(32 * 56 * 56, 128),
|
38 |
nn.ReLU(),
|
39 |
-
nn.Linear(128, 4)
|
40 |
)
|
41 |
|
42 |
def forward(self, x):
|
@@ -44,7 +44,7 @@ class GliomaStageModel(nn.Module):
|
|
44 |
|
45 |
def get_precautions_from_gemini(tumor_type: str) -> str:
|
46 |
db = {
|
47 |
-
"meningioma": "Avoid radiation exposure and get regular check
|
48 |
"pituitary": "Monitor hormonal levels and follow medication strictly.",
|
49 |
"notumor": "Stay healthy and get annual MRI scans if symptoms appear."
|
50 |
}
|
|
|
6 |
|
7 |
class BrainTumorModel(nn.Module):
|
8 |
def __init__(self):
|
9 |
+
super().__init__()
|
10 |
self.model = nn.Sequential(
|
11 |
+
nn.Conv2d(3, 16, 3, padding=1),
|
12 |
nn.ReLU(),
|
13 |
nn.MaxPool2d(2),
|
14 |
+
nn.Conv2d(16, 32, 3, padding=1),
|
15 |
nn.ReLU(),
|
16 |
nn.MaxPool2d(2),
|
17 |
nn.Flatten(),
|
18 |
nn.Linear(32 * 56 * 56, 128),
|
19 |
nn.ReLU(),
|
20 |
+
nn.Linear(128, 4)
|
21 |
)
|
22 |
|
23 |
def forward(self, x):
|
|
|
25 |
|
26 |
class GliomaStageModel(nn.Module):
|
27 |
def __init__(self):
|
28 |
+
super().__init__()
|
29 |
self.model = nn.Sequential(
|
30 |
+
nn.Conv2d(3, 16, 3, padding=1),
|
31 |
nn.ReLU(),
|
32 |
nn.MaxPool2d(2),
|
33 |
+
nn.Conv2d(16, 32, 3, padding=1),
|
34 |
nn.ReLU(),
|
35 |
nn.MaxPool2d(2),
|
36 |
nn.Flatten(),
|
37 |
nn.Linear(32 * 56 * 56, 128),
|
38 |
nn.ReLU(),
|
39 |
+
nn.Linear(128, 4)
|
40 |
)
|
41 |
|
42 |
def forward(self, x):
|
|
|
44 |
|
45 |
def get_precautions_from_gemini(tumor_type: str) -> str:
|
46 |
db = {
|
47 |
+
"meningioma": "Avoid radiation exposure and get regular check‑ups.",
|
48 |
"pituitary": "Monitor hormonal levels and follow medication strictly.",
|
49 |
"notumor": "Stay healthy and get annual MRI scans if symptoms appear."
|
50 |
}
|