yulu2 commited on
Commit
d35a13b
1 Parent(s): d23c2f4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -9
README.md CHANGED
@@ -40,15 +40,18 @@ def download_image(url):
40
  image = image.convert("RGB")
41
  return image
42
 
43
- image = download_image(URL)
 
 
 
44
  width, height = image.size
45
- factor = 512 / max(width, height)
46
- factor = math.ceil(min(width, height) * factor / 64) * 64 / min(width, height)
47
- width = int((width * factor) // 64) * 64
48
- height = int((height * factor) // 64) * 64
49
- image = ImageOps.fit(image, (width, height), method=Image.Resampling.LANCZOS)
50
-
51
- prompt = "Detect the person."
52
- images = pipe(prompt, image=image, num_inference_steps=100).images
53
  images[0]
54
  ```
 
40
  image = image.convert("RGB")
41
  return image
42
 
43
+
44
+ image = download_image(URL)
45
+ seed = random.randint(0, 100000)
46
+ generator = torch.manual_seed(seed)
47
  width, height = image.size
48
+ factor = 512 / max(width, height)
49
+ factor = math.ceil(min(width, height) * factor / 64) * 64 / min(width, height)
50
+ width = int((width * factor) // 64) * 64
51
+ height = int((height * factor) // 64) * 64
52
+ image = ImageOps.fit(image, (width, height), method=Image.Resampling.LANCZOS)
53
+
54
+ prompt = "Detect the person."
55
+ images = pipe(prompt, image=image, num_inference_steps=100, generator=generator).images
56
  images[0]
57
  ```