Spaces:
Sleeping
Sleeping
Kvikontent
commited on
Commit
•
357bfd3
1
Parent(s):
ad200c9
Update app.py
Browse files
app.py
CHANGED
@@ -20,10 +20,10 @@ def generate_qr_image(url, image_size):
|
|
20 |
qr.add_data(url)
|
21 |
qr.make(fit=True)
|
22 |
|
23 |
-
qr_img = qr.make_image(fill_color="black", back_color="white")
|
|
|
24 |
|
25 |
-
|
26 |
-
qr_img = qr_img.resize((image_size[0], image_size[1]))
|
27 |
|
28 |
return qr_img
|
29 |
|
@@ -39,7 +39,7 @@ def query_image(text):
|
|
39 |
def generate_image(url, text):
|
40 |
# Generate image from Hugging Face API
|
41 |
image_bytes = query_image(text)
|
42 |
-
api_image = Image.open(io.BytesIO(image_bytes))
|
43 |
|
44 |
# Generate QR code image
|
45 |
qr_image = generate_qr_image(url, api_image.size)
|
|
|
20 |
qr.add_data(url)
|
21 |
qr.make(fit=True)
|
22 |
|
23 |
+
qr_img = qr.make_image(fill_color="black", back_color="white")
|
24 |
+
qr_img = qr_img.convert("RGBA")
|
25 |
|
26 |
+
qr_img = qr_img.resize(image_size)
|
|
|
27 |
|
28 |
return qr_img
|
29 |
|
|
|
39 |
def generate_image(url, text):
|
40 |
# Generate image from Hugging Face API
|
41 |
image_bytes = query_image(text)
|
42 |
+
api_image = Image.open(io.BytesIO(image_bytes)).convert("RGBA")
|
43 |
|
44 |
# Generate QR code image
|
45 |
qr_image = generate_qr_image(url, api_image.size)
|