Spaces:
Runtime error
Runtime error
Commit ·
9053631
1
Parent(s): 4ea8080
using uploaded model
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch.nn as nn
|
|
| 4 |
import torch.nn.functional as F
|
| 5 |
import random
|
| 6 |
import os
|
|
|
|
| 7 |
|
| 8 |
if torch.cuda.is_available():
|
| 9 |
device = torch.device("cuda:0")
|
|
@@ -46,7 +47,11 @@ class Net(nn.Module):
|
|
| 46 |
net = Net()
|
| 47 |
net.to(device)
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
net.load_state_dict(torch.load(os.path.join('/models/', model)))
|
| 51 |
|
| 52 |
labels = ['Buildings', 'Forest', 'Glacier', 'Mountain', 'Sea', 'Street']
|
|
|
|
| 4 |
import torch.nn.functional as F
|
| 5 |
import random
|
| 6 |
import os
|
| 7 |
+
import huggingface_hub
|
| 8 |
|
| 9 |
if torch.cuda.is_available():
|
| 10 |
device = torch.device("cuda:0")
|
|
|
|
| 47 |
net = Net()
|
| 48 |
net.to(device)
|
| 49 |
|
| 50 |
+
HF_TOKEN = os.environ['HF_TOKEN']
|
| 51 |
+
|
| 52 |
+
model = huggingface_hub.hf_hub_download(
|
| 53 |
+
'danyalmalik/sceneryclassifier', '1655322438.4798265_Acc0.693_modelweights.pth', use_auth_token=HF_TOKEN)
|
| 54 |
+
|
| 55 |
net.load_state_dict(torch.load(os.path.join('/models/', model)))
|
| 56 |
|
| 57 |
labels = ['Buildings', 'Forest', 'Glacier', 'Mountain', 'Sea', 'Street']
|
models/1655322438.4798265_Acc0.693_modelweights.pth
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:bab05245bca6c06515fec6bd9d4f72a8d448fc23f81b888dc1797571136cefc3
|
| 3 |
-
size 60034055
|
|
|
|
|
|
|
|
|
|
|
|