Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,6 @@ def generate_image(prompt):
|
|
| 54 |
if response.status_code == 200:
|
| 55 |
print("Image generation successful!")
|
| 56 |
# Open the image and convert it to grayscale
|
| 57 |
-
image = Image.open(BytesIO(response.content)).convert("L")
|
| 58 |
# Convert the grayscale image to a binary image
|
| 59 |
image = image.point(lambda p: 255 if p > 128 else 0, mode='1')
|
| 60 |
# Convert the PIL image to a numpy array
|
|
@@ -67,6 +66,7 @@ def generate_image(prompt):
|
|
| 67 |
# Generate SVG data
|
| 68 |
svg_data = path.to_svg()
|
| 69 |
return svg_data
|
|
|
|
| 70 |
elif response.status_code == 503:
|
| 71 |
time.sleep(1)
|
| 72 |
pbar.update(1)
|
|
|
|
| 54 |
if response.status_code == 200:
|
| 55 |
print("Image generation successful!")
|
| 56 |
# Open the image and convert it to grayscale
|
|
|
|
| 57 |
# Convert the grayscale image to a binary image
|
| 58 |
image = image.point(lambda p: 255 if p > 128 else 0, mode='1')
|
| 59 |
# Convert the PIL image to a numpy array
|
|
|
|
| 66 |
# Generate SVG data
|
| 67 |
svg_data = path.to_svg()
|
| 68 |
return svg_data
|
| 69 |
+
|
| 70 |
elif response.status_code == 503:
|
| 71 |
time.sleep(1)
|
| 72 |
pbar.update(1)
|