kuldeep0204 commited on
Commit
1e43f57
·
verified ·
1 Parent(s): ef00ad2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,13 @@
1
- from my_model import MyModel # import your architecture
2
 
3
- model = MyModel(...) # initialize with same architecture
4
- state_dict = torch.load("model/model.pt", map_location=device) # works with weights_only=True
5
- model.load_state_dict(state_dict)
 
 
 
 
6
  model.to(device)
7
  model.eval()
 
 
 
1
+ import torch
2
 
3
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
4
+
5
+ MODEL_PATH = "model/model.pt"
6
+
7
+ # load full model (from your .pt file)
8
+ print(f"Loading model from: {MODEL_PATH}")
9
+ model = torch.load(MODEL_PATH, map_location=device, weights_only=False)
10
  model.to(device)
11
  model.eval()
12
+
13
+ print("Model loaded successfully!")