methodw commited on
Commit
391a1fb
·
1 Parent(s): a8c63a3

fix torch jit

Browse files
Files changed (2) hide show
  1. app.py +6 -6
  2. xbgp-faiss.index +1 -1
app.py CHANGED
@@ -14,7 +14,7 @@ dino_v2_image_processor = AutoImageProcessor.from_pretrained("./dinov2-large")
14
 
15
  # Provide a sample input for tracing
16
  sample_input = dino_v2_image_processor(
17
- images=Image.new("RGB", (64, 64)), return_tensors="pt"
18
  ).to(torch_device)
19
  traced_dino_v2_model = torch.jit.trace(dino_v2_model, sample_input["pixel_values"])
20
 
@@ -35,15 +35,15 @@ def process_image(image):
35
  if image.mode != "RGB":
36
  image = image.convert("RGB")
37
 
38
- # Resize to 64px while maintaining aspect ratio
39
  width, height = image.size
40
  if width < height:
41
- w_percent = 64 / float(width)
42
- new_width = 64
43
  new_height = int(float(height) * float(w_percent))
44
  else:
45
- h_percent = 64 / float(height)
46
- new_height = 64
47
  new_width = int(float(width) * float(h_percent))
48
  image = image.resize((new_width, new_height), Image.LANCZOS)
49
 
 
14
 
15
  # Provide a sample input for tracing
16
  sample_input = dino_v2_image_processor(
17
+ images=Image.new("RGB", (224, 224)), return_tensors="pt"
18
  ).to(torch_device)
19
  traced_dino_v2_model = torch.jit.trace(dino_v2_model, sample_input["pixel_values"])
20
 
 
35
  if image.mode != "RGB":
36
  image = image.convert("RGB")
37
 
38
+ # Resize to 224px while maintaining aspect ratio
39
  width, height = image.size
40
  if width < height:
41
+ w_percent = 224 / float(width)
42
+ new_width = 224
43
  new_height = int(float(height) * float(w_percent))
44
  else:
45
+ h_percent = 224 / float(height)
46
+ new_height = 224
47
  new_width = int(float(width) * float(h_percent))
48
  image = image.resize((new_width, new_height), Image.LANCZOS)
49
 
xbgp-faiss.index CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4b93bf8ebe5d15045ce1bdafcb75c834a3ed55f74b5d54ed4f2e135f92c5bc65
3
  size 133390381
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b49f9687667d6556c0c1bf57db916de4305a918974de45f2991786c043e9b87a
3
  size 133390381