Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,6 @@ from datetime import datetime
|
|
6 |
from PIL import Image, ImageDraw
|
7 |
from math import cos, sin, radians
|
8 |
|
9 |
-
# ν
λ리 μ₯μ ν¨μ
|
10 |
def create_border_decoration(qr_image, decoration_prompt="πΈ"):
|
11 |
# Convert QR image to RGB mode first
|
12 |
qr_image = qr_image.convert('RGB')
|
@@ -114,34 +113,7 @@ def create_border_decoration(qr_image, decoration_prompt="πΈ"):
|
|
114 |
|
115 |
return decorated_image
|
116 |
|
117 |
-
|
118 |
-
border_decoration = gr.Dropdown(
|
119 |
-
choices=[
|
120 |
-
"πΈ Cherry Blossoms",
|
121 |
-
"π Four Leaf Clover",
|
122 |
-
"β Stars",
|
123 |
-
"β€οΈ Hearts",
|
124 |
-
"π Sparkles",
|
125 |
-
"π Leaves",
|
126 |
-
"π« Swirls",
|
127 |
-
"β¨ Twinkles",
|
128 |
-
"π Waves",
|
129 |
-
"π¨ Rainbow"
|
130 |
-
],
|
131 |
-
value="πΈ Cherry Blossoms",
|
132 |
-
label="Border Decoration Style"
|
133 |
-
)
|
134 |
-
|
135 |
-
# create_qr ν¨μμμ border_decoration μ²λ¦¬ μμ
|
136 |
-
def create_qr(..., border_decoration="πΈ Cherry Blossoms"):
|
137 |
-
...
|
138 |
-
if border_decoration.strip():
|
139 |
-
emoji = border_decoration.split()[0] # Get only the emoji part
|
140 |
-
qr_img = create_border_decoration(qr_img, emoji)
|
141 |
-
...
|
142 |
-
|
143 |
-
# QR μ½λ μμ± ν¨μ
|
144 |
-
def create_qr(content, qr_type, fill_color, back_color, box_size, border_size, error_correction, border_decoration="flowers"):
|
145 |
# QR μ½λ λ°μ΄ν° ν¬λ§·ν
|
146 |
formatted_data = format_data(content, qr_type)
|
147 |
|
@@ -169,7 +141,8 @@ def create_qr(content, qr_type, fill_color, back_color, box_size, border_size, e
|
|
169 |
|
170 |
# Add border decoration if specified
|
171 |
if border_decoration.strip(): # Only if decoration prompt is not empty
|
172 |
-
|
|
|
173 |
|
174 |
# νμΌ μ μ₯
|
175 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
@@ -310,10 +283,21 @@ def create_interface():
|
|
310 |
label="Error Correction Level"
|
311 |
)
|
312 |
|
313 |
-
border_decoration = gr.
|
314 |
-
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
)
|
318 |
|
319 |
generate_btn = gr.Button(
|
|
|
6 |
from PIL import Image, ImageDraw
|
7 |
from math import cos, sin, radians
|
8 |
|
|
|
9 |
def create_border_decoration(qr_image, decoration_prompt="πΈ"):
|
10 |
# Convert QR image to RGB mode first
|
11 |
qr_image = qr_image.convert('RGB')
|
|
|
113 |
|
114 |
return decorated_image
|
115 |
|
116 |
+
def create_qr(content, qr_type, fill_color, back_color, box_size, border_size, error_correction, border_decoration="πΈ Cherry Blossoms"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
# QR μ½λ λ°μ΄ν° ν¬λ§·ν
|
118 |
formatted_data = format_data(content, qr_type)
|
119 |
|
|
|
141 |
|
142 |
# Add border decoration if specified
|
143 |
if border_decoration.strip(): # Only if decoration prompt is not empty
|
144 |
+
emoji = border_decoration.split()[0] # Get only the emoji part
|
145 |
+
qr_img = create_border_decoration(qr_img, emoji)
|
146 |
|
147 |
# νμΌ μ μ₯
|
148 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
283 |
label="Error Correction Level"
|
284 |
)
|
285 |
|
286 |
+
border_decoration = gr.Dropdown(
|
287 |
+
choices=[
|
288 |
+
"πΈ Cherry Blossoms",
|
289 |
+
"π Four Leaf Clover",
|
290 |
+
"β Stars",
|
291 |
+
"β€οΈ Hearts",
|
292 |
+
"π Sparkles",
|
293 |
+
"π Leaves",
|
294 |
+
"π« Swirls",
|
295 |
+
"β¨ Twinkles",
|
296 |
+
"π Waves",
|
297 |
+
"π¨ Rainbow"
|
298 |
+
],
|
299 |
+
value="πΈ Cherry Blossoms",
|
300 |
+
label="Border Decoration Style"
|
301 |
)
|
302 |
|
303 |
generate_btn = gr.Button(
|