noamholz commited on
Commit
b90cf97
·
verified ·
1 Parent(s): 96a9344

add sleep=2sec

Browse files
Files changed (1) hide show
  1. run.py +2 -2
run.py CHANGED
@@ -20,7 +20,7 @@ model.load_state_dict(torch.load(weights2load, weights_only=True, map_location=d
20
  model.to(device).eval()
21
 
22
 
23
- def flip_periodically(im, interval_ms=0):
24
  """
25
  Flips the image periodically with the given interval.
26
 
@@ -36,7 +36,7 @@ def flip_periodically(im, interval_ms=0):
36
  pixel_values = image_processor(im, return_tensors="pt").pixel_values.to(device)
37
  outputs = model(pixel_values=pixel_values)
38
  logits = outputs.logits.cpu().detach().numpy() ** 2
39
- sleep(interval_ms / 1000) # Convert milliseconds to seconds
40
  imout = (logits[0, 0] - logits[0, 0].min()) / (logits[0, 0].max() - logits[0, 0].min())
41
  return imout #np.flipud(im)
42
 
 
20
  model.to(device).eval()
21
 
22
 
23
+ def flip_periodically(im, interval_s=2):
24
  """
25
  Flips the image periodically with the given interval.
26
 
 
36
  pixel_values = image_processor(im, return_tensors="pt").pixel_values.to(device)
37
  outputs = model(pixel_values=pixel_values)
38
  logits = outputs.logits.cpu().detach().numpy() ** 2
39
+ sleep(interval_s)
40
  imout = (logits[0, 0] - logits[0, 0].min()) / (logits[0, 0].max() - logits[0, 0].min())
41
  return imout #np.flipud(im)
42