Kvikontent commited on
Commit
357bfd3
1 Parent(s): ad200c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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").convert("RGBA")
 
24
 
25
- # Resize the QR code to cover the entire image area
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)