Codewithsalty commited on
Commit
72e8105
·
verified ·
1 Parent(s): 4246195

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +9 -9
utils.py CHANGED
@@ -6,18 +6,18 @@ import torch.nn as nn
6
 
7
  class BrainTumorModel(nn.Module):
8
  def __init__(self):
9
- super(BrainTumorModel, self).__init__()
10
  self.model = nn.Sequential(
11
- nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),
12
  nn.ReLU(),
13
  nn.MaxPool2d(2),
14
- nn.Conv2d(16, 32, kernel_size=3, stride=1, 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) # 4 tumor classes
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(GliomaStageModel, self).__init__()
29
  self.model = nn.Sequential(
30
- nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1),
31
  nn.ReLU(),
32
  nn.MaxPool2d(2),
33
- nn.Conv2d(16, 32, kernel_size=3, stride=1, 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) # 4 glioma stages
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-ups.",
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 checkups.",
48
  "pituitary": "Monitor hormonal levels and follow medication strictly.",
49
  "notumor": "Stay healthy and get annual MRI scans if symptoms appear."
50
  }