OnabajoMonsurat commited on
Commit
300364b
1 Parent(s): 08a95af

First commit for brain tumor prediction app

Browse files
app.py ADDED
File without changes
class_names.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ glioma_tumor
2
+ meningioma_tumor
3
+ no_tumor
4
+ pituitary_tumor
model.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torchvision
3
+ from torch import nn
4
+
5
+ def create_model(num_classes:int=4,
6
+ seed:int=42):
7
+ # Create Effnet pretrained model
8
+ weights= torchvision.models.EfficientNet_B0_Weights.DEFAULT
9
+ transforms= weights.transforms()
10
+ model= torchvision.models.efficientnet_b0(weights=weights)
11
+
12
+ # Freeze all layers in the base model
13
+ for param in model.parameters():
14
+ param.requires_grad= False
15
+
16
+ # Change the classifier layer
17
+ torch.manual_seed(seed)
18
+ model.classifier= nn.Sequential(
19
+ nn.Dropout(p=0.2, inplace= True),
20
+ nn.Linear(in_features= 1280, out_features= num_classes)
21
+ )
22
+ return model, transforms
pretrained_effnetb0_feature_extractor_brain_tumor.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d8e9719814b37a85a389711d67b9b5aed69f433acebba429713765375f16a42
3
+ size 16365077
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch==2.0.1
2
+ torchvision==0.15.2
3
+ gradio==3.35.2