Spaces:
Running
Running
Upload 7 files
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import gradio as gr
|
|
3 |
import os
|
4 |
import torch
|
5 |
|
6 |
-
from torch import nn
|
7 |
from model import create_resnet50_model
|
8 |
from timeit import default_timer as timer
|
9 |
from typing import Tuple, Dict
|
@@ -17,7 +16,7 @@ class_names = ['CRVO',
|
|
17 |
'Macular Hole',
|
18 |
'Myelinated Nerve Fiber',
|
19 |
'Normal',
|
20 |
-
'Pathological
|
21 |
'Retinitis Pigmentosa']
|
22 |
|
23 |
### 2. Model and transforms preparation ###
|
@@ -28,7 +27,7 @@ resnet50, resnet50_transforms = create_resnet50_model(
|
|
28 |
)
|
29 |
resnet50.fc = nn.Linear(2048, 10)
|
30 |
|
31 |
-
# Load
|
32 |
resnet50.load_state_dict(
|
33 |
torch.load(
|
34 |
f="pretrained_resnet50_feature_extractor_drappcompressed.pth",
|
@@ -80,7 +79,10 @@ demo = gr.Interface(fn=predict, # mapping function from input to output
|
|
80 |
outputs=[gr.Label(num_top_classes=3, label="Predictions"), # what are the outputs?
|
81 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
82 |
# Create examples list from "examples/" directory
|
83 |
-
examples=example_list)
|
|
|
|
|
|
|
84 |
|
85 |
# Launch the demo!
|
86 |
demo.launch()
|
|
|
3 |
import os
|
4 |
import torch
|
5 |
|
|
|
6 |
from model import create_resnet50_model
|
7 |
from timeit import default_timer as timer
|
8 |
from typing import Tuple, Dict
|
|
|
16 |
'Macular Hole',
|
17 |
'Myelinated Nerve Fiber',
|
18 |
'Normal',
|
19 |
+
'Pathological Mypoia',
|
20 |
'Retinitis Pigmentosa']
|
21 |
|
22 |
### 2. Model and transforms preparation ###
|
|
|
27 |
)
|
28 |
resnet50.fc = nn.Linear(2048, 10)
|
29 |
|
30 |
+
# Load saved weights
|
31 |
resnet50.load_state_dict(
|
32 |
torch.load(
|
33 |
f="pretrained_resnet50_feature_extractor_drappcompressed.pth",
|
|
|
79 |
outputs=[gr.Label(num_top_classes=3, label="Predictions"), # what are the outputs?
|
80 |
gr.Number(label="Prediction time (s)")], # our fn has two outputs, therefore we have two outputs
|
81 |
# Create examples list from "examples/" directory
|
82 |
+
examples=example_list)
|
83 |
+
#title=title,
|
84 |
+
#description=description,
|
85 |
+
#article=article)
|
86 |
|
87 |
# Launch the demo!
|
88 |
demo.launch()
|
examples/pm252.jpg
ADDED
pretrained_resnet50_feature_extractor_drappcompressed.pth
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 94528949
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:441fc37b888752f96603186b5073023065c3699fa5b04aa58354474a09d43bae
|
3 |
size 94528949
|