Update README.md
Browse files
README.md
CHANGED
|
@@ -40,15 +40,18 @@ def download_image(url):
|
|
| 40 |
image = image.convert("RGB")
|
| 41 |
return image
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
width, height = image.size
|
| 45 |
-
factor
|
| 46 |
-
factor
|
| 47 |
-
width
|
| 48 |
-
height
|
| 49 |
-
image
|
| 50 |
-
|
| 51 |
-
prompt
|
| 52 |
-
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 |
```
|