Ahsen Khaliq commited on
Commit
c33a1bf
1 Parent(s): bd30016

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -15,10 +15,11 @@ import gradio as gr
15
  # Device on which to run the model
16
  # Set to cuda to load on GPU
17
  device = "cpu"
18
-
19
  # Pick a pretrained model
20
  model_name = "omnivore_swinB"
21
- model = torch.hub.load("facebookresearch/omnivore:main", model=model_name)
 
22
 
23
  # Set to eval mode and move to desired device
24
  model = model.to(device)
 
15
  # Device on which to run the model
16
  # Set to cuda to load on GPU
17
  device = "cpu"
18
+ os.system("wget https://huggingface.co/akhaliq/Omnivore/resolve/main/swinB_checkpoint.torch")
19
  # Pick a pretrained model
20
  model_name = "omnivore_swinB"
21
+ model = torch.hub.load('facebookresearch/omnivore:main', "omnivore_swinB", pretrained=False)
22
+ model.load_state_dict(torch.load('/home/user/app/swinB_checkpoint.torch'))
23
 
24
  # Set to eval mode and move to desired device
25
  model = model.to(device)