yfyangd commited on
Commit
2575ee4
·
1 Parent(s): 8c9ecba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -43,7 +43,7 @@ def load_list(filename):
43
 
44
  def rank(model, image_features, text_array, top_count=1):
45
  top_count = min(top_count, len(text_array))
46
- text_tokens = clip.tokenize([text for text in text_array]).cuda()
47
  with torch.no_grad():
48
  text_features = model.encode_text(text_tokens).float()
49
  text_features /= text_features.norm(dim=-1, keepdim=True)
@@ -73,7 +73,7 @@ def interrogate(cover):
73
  model, preprocess = clip.load(model_name)
74
  #model.cuda().eval()
75
 
76
- images = preprocess(image).unsqueeze(0).cuda()
77
  with torch.no_grad():
78
  image_features = model.encode_image(images).float()
79
  image_features /= image_features.norm(dim=-1, keepdim=True)
 
43
 
44
  def rank(model, image_features, text_array, top_count=1):
45
  top_count = min(top_count, len(text_array))
46
+ text_tokens = clip.tokenize([text for text in text_array])#.cuda()
47
  with torch.no_grad():
48
  text_features = model.encode_text(text_tokens).float()
49
  text_features /= text_features.norm(dim=-1, keepdim=True)
 
73
  model, preprocess = clip.load(model_name)
74
  #model.cuda().eval()
75
 
76
+ images = preprocess(image).unsqueeze(0)#.cuda()
77
  with torch.no_grad():
78
  image_features = model.encode_image(images).float()
79
  image_features /= image_features.norm(dim=-1, keepdim=True)