RQOBIST commited on
Commit
1a000ad
·
verified ·
1 Parent(s): b75b0f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
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(fill="black", back_color="white")
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)