Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2, torch
|
2 |
+
import gradio as gr
|
3 |
+
import numpy as np
|
4 |
+
import torchvision.models as models
|
5 |
+
from torchvision import transforms as T
|
6 |
+
|
7 |
+
new_model = models.resnet18()
|
8 |
+
num_ftrs = new_model.fc.in_features
|
9 |
+
new_model.fc = nn.Linear(num_ftrs, 75)
|
10 |
+
checkpoint = torch.load('model_best_checkpoint.pth.tar')
|
11 |
+
new_model.load_state_dict(checkpoint['model'])
|
12 |
+
new_model.to(device)
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
|