Update Special back
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
import qrcode
|
6 |
from datetime import datetime
|
7 |
import pytz
|
|
|
8 |
|
9 |
# νκ΅ μκ°λ μ€μ
|
10 |
korea_timezone = pytz.timezone('Asia/Seoul')
|
@@ -15,10 +16,7 @@ current_time_korea = datetime.now(pytz.utc).astimezone(korea_timezone)
|
|
15 |
output_path = 'outputs'
|
16 |
|
17 |
if not os.path.exists(output_path):
|
18 |
-
print("Not exists")
|
19 |
os.makedirs(output_path)
|
20 |
-
else:
|
21 |
-
print("exists")
|
22 |
|
23 |
|
24 |
def create_qr_with_icon(url, icon_path, resolution=(335, 335), border_reduction=2):
|
@@ -365,6 +363,8 @@ def generate_back(img, obj_color, obj_color_picker, obj_color_img, txt_color, tx
|
|
365 |
objekt_color = "#00ff01"
|
366 |
if obj_color == "Cream01":
|
367 |
objekt_color = "#ff7477"
|
|
|
|
|
368 |
if obj_color == "Other color":
|
369 |
objekt_color = obj_color_picker
|
370 |
if obj_color == None:
|
@@ -403,9 +403,11 @@ def generate_back(img, obj_color, obj_color_picker, obj_color_img, txt_color, tx
|
|
403 |
season = radio_season
|
404 |
# Resize and crop the input image
|
405 |
resized_image = load_image_as_pil('all.png')
|
406 |
-
|
407 |
-
|
408 |
-
|
|
|
|
|
409 |
|
410 |
colored_icon = change_color(objekt_color_outline, 'outline.png')
|
411 |
resized_image.paste(colored_icon, (0, 0), colored_icon)
|
@@ -523,14 +525,12 @@ def update_obj_color_img_visibility(obj_color_img):
|
|
523 |
else:
|
524 |
return gr.Image(visible=False)
|
525 |
|
526 |
-
|
527 |
def update_txt_color_picker_visibility(txt_color_picker):
|
528 |
if txt_color_picker == "Other":
|
529 |
return gr.Image(visible=True)
|
530 |
else:
|
531 |
return gr.Image(visible=False)
|
532 |
|
533 |
-
|
534 |
def update_txt_name_visibility(dropdown_group_name):
|
535 |
if dropdown_group_name == "Other":
|
536 |
return gr.Textbox(visible=True, interactive=True)
|
@@ -543,43 +543,27 @@ def update_txt_group_name_visibility(a):
|
|
543 |
else:
|
544 |
return gr.Textbox(visible=False)
|
545 |
|
546 |
-
|
547 |
def update_alpa_visibiliy(a):
|
548 |
if a == "Other":
|
549 |
return gr.Textbox(visible=True)
|
550 |
else:
|
551 |
return gr.Textbox(visible=False)
|
552 |
|
553 |
-
|
554 |
def update_chk_num(a):
|
555 |
if a == True:
|
556 |
return gr.Textbox(visible=True), gr.Radio(visible=True), gr.Textbox(visible=True)
|
557 |
else:
|
558 |
return gr.Textbox(visible=False), gr.Radio(visible=False), gr.Textbox(visible=False)
|
559 |
|
560 |
-
|
561 |
-
#obj_color, obj_color_picker, obj_color_img, txt_color, txt_color_picker, dropdown_name, txt_name, radio_txt_group_name, txt_group_name, chk, obj_num, choose_z_a, choose_etc, obj_count
|
562 |
def clear(a):
|
563 |
return gr.Radio(value=None), gr.ColorPicker(value=None), gr.Image(value=None), gr.Radio(value=None), gr.ColorPicker(value="#ffffff"), gr.Dropdown(value=""), gr.Textbox(value=None), gr.Radio(value=None), gr.Textbox(value=None), gr.Checkbox(value=True), gr.Textbox(value=None), gr.Radio(value=None), gr.Textbox(value=None), gr.Textbox(value=None), gr.Checkbox(value=None)
|
564 |
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
valv = ""
|
570 |
-
css = """
|
571 |
-
.purple-button .btn {
|
572 |
-
background-color: purple;
|
573 |
-
color: white;
|
574 |
-
}
|
575 |
-
"""
|
576 |
def flip_back(a):
|
577 |
return gr.Row(visible=False), gr.Row(visible=True), gr.Button(visible=False), gr.Button(visible=True), gr.Image
|
578 |
|
579 |
def flip_front(a):
|
580 |
return gr.Row(visible=True), gr.Row(visible=False), gr.Button(visible=True), gr.Button(visible=False)
|
581 |
|
582 |
-
|
583 |
def txt_class_visibility(a):
|
584 |
if a == "Other":
|
585 |
return gr.Textbox(visible=True)
|
@@ -589,7 +573,6 @@ def txt_class_visibility(a):
|
|
589 |
def chk_sync(a):
|
590 |
return gr.Checkbox(value=a)
|
591 |
|
592 |
-
|
593 |
def obj_color_outline_picker_visibility(a):
|
594 |
if a == "Other":
|
595 |
return gr.ColorPicker(visible=True)
|
@@ -604,6 +587,7 @@ def txt_season_visibility(a):
|
|
604 |
|
605 |
|
606 |
|
|
|
607 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
608 |
with gr.Row():
|
609 |
gr.Markdown(
|
@@ -671,6 +655,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
671 |
txt_season = gr.Textbox(label="Other SEASON", interactive=True, visible=False)
|
672 |
with gr.Group():
|
673 |
qr_url = gr.Dropdown(["tripleS website", "tripleS youtube", "tripleS π", "tripleS discord"], label="qr url", info="Can write any url", allow_custom_value=True)
|
|
|
|
|
|
|
674 |
with gr.Group():
|
675 |
cr = gr.Checkbox(label="Add Rights", value=False, interactive=True)
|
676 |
with gr.Group():
|
|
|
5 |
import qrcode
|
6 |
from datetime import datetime
|
7 |
import pytz
|
8 |
+
import paramiko
|
9 |
|
10 |
# νκ΅ μκ°λ μ€μ
|
11 |
korea_timezone = pytz.timezone('Asia/Seoul')
|
|
|
16 |
output_path = 'outputs'
|
17 |
|
18 |
if not os.path.exists(output_path):
|
|
|
19 |
os.makedirs(output_path)
|
|
|
|
|
20 |
|
21 |
|
22 |
def create_qr_with_icon(url, icon_path, resolution=(335, 335), border_reduction=2):
|
|
|
363 |
objekt_color = "#00ff01"
|
364 |
if obj_color == "Cream01":
|
365 |
objekt_color = "#ff7477"
|
366 |
+
if obj_color == "Special":
|
367 |
+
objekt_color = "Special"
|
368 |
if obj_color == "Other color":
|
369 |
objekt_color = obj_color_picker
|
370 |
if obj_color == None:
|
|
|
403 |
season = radio_season
|
404 |
# Resize and crop the input image
|
405 |
resized_image = load_image_as_pil('all.png')
|
406 |
+
if not objekt_color == "Special":
|
407 |
+
colored_icon = change_color(objekt_color, 'all.png')
|
408 |
+
resized_image.paste(colored_icon, (0, 0), colored_icon)
|
409 |
+
else:
|
410 |
+
resized_image = Image.open('special_back.png')
|
411 |
|
412 |
colored_icon = change_color(objekt_color_outline, 'outline.png')
|
413 |
resized_image.paste(colored_icon, (0, 0), colored_icon)
|
|
|
525 |
else:
|
526 |
return gr.Image(visible=False)
|
527 |
|
|
|
528 |
def update_txt_color_picker_visibility(txt_color_picker):
|
529 |
if txt_color_picker == "Other":
|
530 |
return gr.Image(visible=True)
|
531 |
else:
|
532 |
return gr.Image(visible=False)
|
533 |
|
|
|
534 |
def update_txt_name_visibility(dropdown_group_name):
|
535 |
if dropdown_group_name == "Other":
|
536 |
return gr.Textbox(visible=True, interactive=True)
|
|
|
543 |
else:
|
544 |
return gr.Textbox(visible=False)
|
545 |
|
|
|
546 |
def update_alpa_visibiliy(a):
|
547 |
if a == "Other":
|
548 |
return gr.Textbox(visible=True)
|
549 |
else:
|
550 |
return gr.Textbox(visible=False)
|
551 |
|
|
|
552 |
def update_chk_num(a):
|
553 |
if a == True:
|
554 |
return gr.Textbox(visible=True), gr.Radio(visible=True), gr.Textbox(visible=True)
|
555 |
else:
|
556 |
return gr.Textbox(visible=False), gr.Radio(visible=False), gr.Textbox(visible=False)
|
557 |
|
|
|
|
|
558 |
def clear(a):
|
559 |
return gr.Radio(value=None), gr.ColorPicker(value=None), gr.Image(value=None), gr.Radio(value=None), gr.ColorPicker(value="#ffffff"), gr.Dropdown(value=""), gr.Textbox(value=None), gr.Radio(value=None), gr.Textbox(value=None), gr.Checkbox(value=True), gr.Textbox(value=None), gr.Radio(value=None), gr.Textbox(value=None), gr.Textbox(value=None), gr.Checkbox(value=None)
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
def flip_back(a):
|
562 |
return gr.Row(visible=False), gr.Row(visible=True), gr.Button(visible=False), gr.Button(visible=True), gr.Image
|
563 |
|
564 |
def flip_front(a):
|
565 |
return gr.Row(visible=True), gr.Row(visible=False), gr.Button(visible=True), gr.Button(visible=False)
|
566 |
|
|
|
567 |
def txt_class_visibility(a):
|
568 |
if a == "Other":
|
569 |
return gr.Textbox(visible=True)
|
|
|
573 |
def chk_sync(a):
|
574 |
return gr.Checkbox(value=a)
|
575 |
|
|
|
576 |
def obj_color_outline_picker_visibility(a):
|
577 |
if a == "Other":
|
578 |
return gr.ColorPicker(visible=True)
|
|
|
587 |
|
588 |
|
589 |
|
590 |
+
|
591 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
592 |
with gr.Row():
|
593 |
gr.Markdown(
|
|
|
655 |
txt_season = gr.Textbox(label="Other SEASON", interactive=True, visible=False)
|
656 |
with gr.Group():
|
657 |
qr_url = gr.Dropdown(["tripleS website", "tripleS youtube", "tripleS π", "tripleS discord"], label="qr url", info="Can write any url", allow_custom_value=True)
|
658 |
+
with gr.Row():
|
659 |
+
qr_option1 = gr.Checkbox(label="tripleS logo", value=False, interactive=True)
|
660 |
+
qr_option2 = gr.Checkbox(label="ARTMS (Cosmo) logo", value=False, interactive=True)
|
661 |
with gr.Group():
|
662 |
cr = gr.Checkbox(label="Add Rights", value=False, interactive=True)
|
663 |
with gr.Group():
|