nick_93 commited on
Commit
9c81e89
1 Parent(s): 0078986
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -109,11 +109,11 @@ def main():
109
  args = opt.parse_args()
110
 
111
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
112
- model = EVPDepth(args=args, caption_aggregation=True)
113
- model.to(device)
114
- model_weight = torch.load('best_model_nyu.ckpt', map_location=device)['model']
115
- model.load_state_dict(model_weight, strict=False)
116
- model.eval()
117
  tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
118
  model_refseg = EVPRefer()
119
  model_refseg.to(device)
@@ -121,6 +121,8 @@ def main():
121
  model_refseg.load_state_dict(model_weight, strict=False)
122
  model_refseg.eval()
123
 
 
 
124
 
125
  title = "# EVP"
126
  description = """Official demo for **EVP: Enhanced Visual Perception using Inverse Multi-Attentive Feature
@@ -132,7 +134,7 @@ def main():
132
  gr.Markdown(title)
133
  gr.Markdown(description)
134
  with gr.Tab("Depth Prediction"):
135
- create_depth_demo(model, device)
136
  with gr.Tab("Referring Segmentation"):
137
  create_refseg_demo(model_refseg, tokenizer, device)
138
  gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/MykolaL/evp?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
 
109
  args = opt.parse_args()
110
 
111
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
112
+ #model = EVPDepth(args=args, caption_aggregation=True)
113
+ #model.to(device)
114
+ #model_weight = torch.load('best_model_nyu.ckpt', map_location=device)['model']
115
+ #model.load_state_dict(model_weight, strict=False)
116
+ #model.eval()
117
  tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
118
  model_refseg = EVPRefer()
119
  model_refseg.to(device)
 
121
  model_refseg.load_state_dict(model_weight, strict=False)
122
  model_refseg.eval()
123
 
124
+ del model_weight
125
+ print('Models uploaded successfully')
126
 
127
  title = "# EVP"
128
  description = """Official demo for **EVP: Enhanced Visual Perception using Inverse Multi-Attentive Feature
 
134
  gr.Markdown(title)
135
  gr.Markdown(description)
136
  with gr.Tab("Depth Prediction"):
137
+ create_depth_demo(model_refseg, device)
138
  with gr.Tab("Referring Segmentation"):
139
  create_refseg_demo(model_refseg, tokenizer, device)
140
  gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/MykolaL/evp?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>