Spaces:
Runtime error
Runtime error
Update bf_trigger.py
Browse files- bf_trigger.py +1 -4
bf_trigger.py
CHANGED
|
@@ -189,11 +189,8 @@ def get_seo_tags(image_url, topical_map, new_imgs, attempts=0, max_attempts=5):
|
|
| 189 |
|
| 190 |
def compress_and_encode_image(url, target_size_mb=20, quality=70):
|
| 191 |
# Fetch the image from the URL
|
| 192 |
-
response = requests.get(url)
|
| 193 |
-
response.raise_for_status() # Ensure the request succeeded
|
| 194 |
-
|
| 195 |
# Open the image using Pillow
|
| 196 |
-
img = Image.open(
|
| 197 |
img = img.convert('RGB')
|
| 198 |
|
| 199 |
# Compress the image by adjusting the quality
|
|
|
|
| 189 |
|
| 190 |
def compress_and_encode_image(url, target_size_mb=20, quality=70):
|
| 191 |
# Fetch the image from the URL
|
|
|
|
|
|
|
|
|
|
| 192 |
# Open the image using Pillow
|
| 193 |
+
img = Image.open(requests.get(url, stream=True).raw)
|
| 194 |
img = img.convert('RGB')
|
| 195 |
|
| 196 |
# Compress the image by adjusting the quality
|