Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import qrcode
|
| 3 |
import qrcode.constants
|
|
|
|
| 4 |
|
| 5 |
def get_qr_image(data: str, fill_color: str = None, back_color: str = None):
|
| 6 |
"""
|
|
@@ -24,7 +25,10 @@ def get_qr_image(data: str, fill_color: str = None, back_color: str = None):
|
|
| 24 |
qr.add_data(data)
|
| 25 |
qr.make(fit=True)
|
| 26 |
|
|
|
|
| 27 |
img = qr.make_image(fill_color=fill_color, back_color=back_color)
|
|
|
|
|
|
|
| 28 |
return img
|
| 29 |
|
| 30 |
def generate_qr(url, fill_color=None, back_color=None):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import qrcode
|
| 3 |
import qrcode.constants
|
| 4 |
+
from PIL import Image
|
| 5 |
|
| 6 |
def get_qr_image(data: str, fill_color: str = None, back_color: str = None):
|
| 7 |
"""
|
|
|
|
| 25 |
qr.add_data(data)
|
| 26 |
qr.make(fit=True)
|
| 27 |
|
| 28 |
+
# Explicitly create a PIL Image and convert to RGB mode
|
| 29 |
img = qr.make_image(fill_color=fill_color, back_color=back_color)
|
| 30 |
+
img = img.convert('RGB')
|
| 31 |
+
|
| 32 |
return img
|
| 33 |
|
| 34 |
def generate_qr(url, fill_color=None, back_color=None):
|