Spaces:
Running
Running
File size: 2,615 Bytes
d10d21b 62383cd d10d21b 62383cd d10d21b 62383cd d10d21b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import pre
import gradio as gr
import preset_fn
def save(preset_name, artist_name, group_name, company_name, top_logo_img, qr_logo_img, sign_img1, sign_img2, sign_img3, sign_img4, sign_img5, sign_img6, sign_img7, sign_img8, sign_img9, sign_img10, sign_img11, sign_img12, userid, user_name):
group_name_radio = gr.Radio(choices=pre.groups, label="Group Name")
member_name_dropdown = gr.Dropdown(choices=pre.names, label="Member Name", allow_custom_value=True)
logo_radio = gr.Radio(choices=pre.groups, label="Add Logo", interactive=True, value="None")
sign = gr.Dropdown(choices=pre.names, label="Sign")
qr_Logo_radio = gr.Radio(["tripleS", "None"], label="QR Logo", value="None", interactive=True)
signs = [sign_img1, sign_img2, sign_img3, sign_img4, sign_img5, sign_img6, sign_img7, sign_img8, sign_img9, sign_img10, sign_img11, sign_img12]
if any(arg is None for arg in (preset_name, artist_name, group_name, company_name, top_logo_img, qr_logo_img)):
gr.Warning("Fill all blank")
return group_name_radio, member_name_dropdown, logo_radio, sign, qr_Logo_radio, sign_img1, sign_img2, sign_img3, sign_img4, sign_img5, sign_img6, sign_img7, sign_img8, sign_img9, sign_img10, sign_img11, sign_img12
for i in range(len(artist_name)):
if signs[i] is None:
gr.Warning("Fill all blank")
return group_name_radio, member_name_dropdown, logo_radio, sign, qr_Logo_radio, sign_img1, sign_img2, sign_img3, sign_img4, sign_img5, sign_img6, sign_img7, sign_img8, sign_img9, sign_img10, sign_img11, sign_img12
group_name_radio = gr.Radio(choices=[group_name] + pre.groups_Other, label="Group Name", value=group_name)
member_name_dropdown = gr.Dropdown(choices=artist_name, label="Member Name", allow_custom_value=True, value=artist_name[0])
logo_radio = gr.Radio(choices=[group_name] + pre.groups, label="Add Logo", interactive=True, value=group_name)
sign = gr.Dropdown(choices=artist_name + pre.names, label="Sign", value=artist_name[0])
qr_Logo_radio = gr.Radio([group_name] + ["tripleS", "None"], label="QR Logo", value=group_name, interactive=True)
preset_id = preset_fn.create(userid, user_name, preset_name, group_name, artist_name, company_name, top_logo_img, qr_logo_img, sign_img1, sign_img2, sign_img3, sign_img4, sign_img5, sign_img6, sign_img7, sign_img8, sign_img9, sign_img10, sign_img11, sign_img12)
folders = preset_fn.refresh_folder()
preset = gr.Dropdown(choices=folders, value=preset_id)
return group_name_radio, member_name_dropdown, logo_radio, sign, qr_Logo_radio, preset |