Spaces:
Sleeping
Sleeping
filipzawadka
commited on
Commit
•
67f9c4e
1
Parent(s):
4873b31
model registry
Browse files
app.py
CHANGED
@@ -7,6 +7,14 @@ import torch
|
|
7 |
import torchvision.models as models
|
8 |
import torch.nn as nn
|
9 |
import io
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
class FarmNet(nn.Module):
|
12 |
def __init__(self):
|
@@ -29,7 +37,7 @@ class FarmNet(nn.Module):
|
|
29 |
return x
|
30 |
|
31 |
model = FarmNet() # Replace with your model and architecture
|
32 |
-
model.load_state_dict(torch.load('farmnet_model.pth'))
|
33 |
model.eval() # Set the model to evaluation mode
|
34 |
|
35 |
# Preprocess the image
|
|
|
7 |
import torchvision.models as models
|
8 |
import torch.nn as nn
|
9 |
import io
|
10 |
+
import wandb
|
11 |
+
|
12 |
+
run = wandb.init(project="farmnet", job_type='inference')
|
13 |
+
artifact = run.use_artifact("farmnet_model_1:latest", type='model')
|
14 |
+
artifact_dir = artifact.download()
|
15 |
+
wandb.finish()
|
16 |
+
|
17 |
+
|
18 |
|
19 |
class FarmNet(nn.Module):
|
20 |
def __init__(self):
|
|
|
37 |
return x
|
38 |
|
39 |
model = FarmNet() # Replace with your model and architecture
|
40 |
+
model.load_state_dict(torch.load('artifacts/farmnet_model_1:v0/farmnet_model.pth'))
|
41 |
model.eval() # Set the model to evaluation mode
|
42 |
|
43 |
# Preprocess the image
|