Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,13 @@ def generate_qr(url):
|
|
| 13 |
qr.add_data(url)
|
| 14 |
qr.make(fit=True)
|
| 15 |
|
| 16 |
-
img = qr.make_image(
|
| 17 |
|
| 18 |
# Save to BytesIO for download
|
| 19 |
img_io = BytesIO()
|
| 20 |
img.save(img_io, format="PNG")
|
| 21 |
img_io.seek(0)
|
| 22 |
|
| 23 |
-
# Ensure file remains open when accessed
|
| 24 |
return img, ("qr_code.png", img_io.getvalue())
|
| 25 |
|
| 26 |
iface = gr.Interface(
|
|
@@ -34,5 +33,4 @@ iface = gr.Interface(
|
|
| 34 |
description="Enter a URL to generate and download a QR Code."
|
| 35 |
)
|
| 36 |
|
| 37 |
-
iface.launch()
|
| 38 |
-
|
|
|
|
| 13 |
qr.add_data(url)
|
| 14 |
qr.make(fit=True)
|
| 15 |
|
| 16 |
+
img = qr.make_image(fill_color="black", back_color="white").convert("RGB") # Convert to PIL.Image.Image
|
| 17 |
|
| 18 |
# Save to BytesIO for download
|
| 19 |
img_io = BytesIO()
|
| 20 |
img.save(img_io, format="PNG")
|
| 21 |
img_io.seek(0)
|
| 22 |
|
|
|
|
| 23 |
return img, ("qr_code.png", img_io.getvalue())
|
| 24 |
|
| 25 |
iface = gr.Interface(
|
|
|
|
| 33 |
description="Enter a URL to generate and download a QR Code."
|
| 34 |
)
|
| 35 |
|
| 36 |
+
iface.launch(share=True)
|
|
|