chohj06ms commited on
Commit
38914b3
·
verified ·
1 Parent(s): 61296fa

Delete main.py

Browse files
Files changed (1) hide show
  1. main.py +0 -212
main.py DELETED
@@ -1,212 +0,0 @@
1
- import gradio as gr
2
- import fns
3
- import generate
4
- import os
5
-
6
-
7
-
8
-
9
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
10
- with gr.Row():
11
- gr.Markdown(
12
- """
13
- # Custom Objekt
14
- ## Input image and Select Options
15
- """)
16
-
17
- with gr.Tab("Front"):
18
- with gr.Row():
19
- with gr.Column(): #1
20
- img_type = gr.Radio(["Image", "Gif"], value="Image", scale=1, label="type")
21
- img_static = gr.Image(label="Image", interactive=True, sources=['upload', 'clipboard'], type="pil", visible=True, scale=10)
22
- img_dynamic_file = gr.File(file_types=[".gif"], visible=False, scale=1, interactive=True, label="Gif File", type="filepath")
23
- img_dynamic_show = gr.Image(label="Gif", interactive=False, sources=['upload', 'clipboard'], type="pil", visible=False, scale=10)
24
-
25
-
26
- img_type.change(fn=fns.change_img_type, inputs=[img_type], outputs=[img_static, img_dynamic_file, img_dynamic_show])
27
- img_static.upload(fn=fns.img2cache_resize, inputs=img_static, outputs=img_static)
28
- img_dynamic_file.upload(fn=fns.gif2cache, inputs=img_dynamic_file, outputs=img_dynamic_show)
29
- img_dynamic_file.clear(fn=fns.gif_clear, outputs=img_dynamic_show)
30
-
31
-
32
- with gr.Column(): #2
33
- with gr.Group(): #objekt color
34
- obj_color = gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "Other color", "AI Color"], label="Objekt Color", value="Cream01")
35
-
36
- with gr.Row():
37
- ai_num = gr.Slider(1, 1000, 500, label="AI Serial", visible=False, step=1)
38
- change_ai = gr.Button(value="Change AI", visible=False)
39
- obj_color_picker = gr.ColorPicker(label="Other Objekt Color", visible=False, interactive=True, value="#ffffff")
40
-
41
-
42
- obj_color.change(fn=fns.obj_color_update, inputs=obj_color, outputs=[obj_color_picker, ai_num, change_ai])
43
-
44
-
45
- with gr.Group():
46
- txt_color = gr.Radio(["White", "Black", "Other"], label="Text Color", value="Black")
47
- txt_color_picker = gr.ColorPicker(label="Other Text Color", value="#ffffff", visible=False, interactive=True)
48
- txt_color.change(fns.txt_color_update, txt_color, txt_color_picker)
49
- with gr.Group():
50
- group_name_radio = gr.Radio(["tripleS", "ARTMS", "Other"], label="Group Name")
51
- group_name_txt = gr.Textbox(label="Other Group name", placeholder="CLASSY", visible=False, interactive=True)
52
-
53
- with gr.Group():
54
- member_name_dropdown = gr.Dropdown(
55
- ["SeoYeon", "HyeRin", "JiWoo", "ChaeYeon", "YooYeon", "SooMin", "NaKyoung", "YuBin", "Kaede",
56
- "DaHyun", "Kotone", "YeonJi", "Nien", "SoHyun", "Xinyu", "Mayu", "Lynn", "JooBin", "HaYeon",
57
- "ShiOn", "ChaeWon", "Sullin", "SeoAh", "JiYeon"], label="Member Name", allow_custom_value=True)
58
-
59
- group_name_radio.change(fns.group_member_name_update, group_name_radio, [group_name_txt, member_name_dropdown])
60
-
61
-
62
- with gr.Accordion("Add Objekt Number", open=False):
63
- with gr.Row():
64
- obj_num = gr.Textbox(label="Objekt Number", placeholder="100", interactive=True, visible=True, scale=1)
65
- obj_alphabet = gr.Radio(["Z", "A", "Other"], label="Z or A", interactive=True, visible=True, scale=1)
66
- obj_alphabet_txt = gr.Textbox(label="Alphabet", placeholder="S", interactive=True, visible=False, scale=1)
67
-
68
- obj_alphabet.change(fns.alphabet_txt_update, obj_alphabet, obj_alphabet_txt)
69
-
70
-
71
- with gr.Row():
72
- obj_serial = gr.Textbox(label="Objekt Serial", placeholder="00001", interactive=True, visible=True, scale=1)
73
- obj_serial_random = gr.Button(value="Random Serial", interactive=True, visible=True, scale=1)
74
-
75
-
76
- obj_serial_random.click(fn=fns.serial_random, outputs=obj_serial)
77
-
78
-
79
- with gr.Group():
80
- rounded = gr.Checkbox(label="Rounded", value=True, interactive=True)
81
- with gr.Group():
82
- generate_btn = gr.Button(value="Generate")
83
-
84
- with gr.Column():
85
- edited_img = gr.Image(label="Edited Image", scale=10)
86
-
87
-
88
- with gr.Tab("Back") as back_tab:
89
- with gr.Row():
90
- preview = gr.Image(label="Image", interactive=False)
91
- with gr.Column():
92
- with gr.Group():
93
- obj_outline_color = gr.Radio(["White", "Black", "Other"], label="Frame color", value="White")
94
- obj_outline_color_picker = gr.ColorPicker(label="Other Outline Color", value="#ffffff", visible=False, interactive=True)
95
-
96
- obj_outline_color.change(fns.frame_color_update, obj_outline_color, obj_outline_color_picker)
97
-
98
- with gr.Group():
99
- logo_radio = gr.Radio(["tripleS", "ARTMS", "None"], label="Add Logo", interactive=True, value="None")
100
-
101
-
102
- with gr.Group():
103
- class_radio = gr.Radio(["Zero", "First", "Double", "Special", "Other"], label="CLASS", visible=True)
104
- class_txt = gr.Textbox(label="Other class", placeholder="Third", visible=False)
105
-
106
- class_radio.change(fns.txt_class_visibility, class_radio, class_txt)
107
-
108
- with gr.Group():
109
- season_radio = gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Other"], label="SEASON", type="value")
110
-
111
- with gr.Row():
112
- season_txt = gr.Textbox(label="Other SEASON", interactive=True, visible=False)
113
- season_txt_outline = gr.Textbox(label="Other SEASON Outline", interactive=True, visible=False)
114
-
115
- season_radio.change(fns.txt_season_visibility, season_radio, [season_txt, season_txt_outline])
116
-
117
- with gr.Group():
118
- sign = gr.Dropdown(
119
- ["SeoYeon", "HyeRin", "JiWoo", "ChaeYeon", "YooYeon", "SooMin", "NaKyoung", "YuBin", "Kaede",
120
- "DaHyun", "Kotone", "YeonJi", "Nien", "SoHyun", "Xinyu", "Mayu", "Lynn", "JooBin", "HaYeon",
121
- "ShiOn", "ChaeWon", "Sullin", "SeoAh", "JiYeon", "HeeJin", "KimLip", "JinSoul", "Choerry", "HaSeul"], label="Sign", type='index')
122
- with gr.Group():
123
- qr_url_dropdown = gr.Dropdown(["tripleS website", "tripleS youtube", "tripleS 𝕏", "tripleS discord"],
124
- label="qr url", info="Can write any url", allow_custom_value=True)
125
- with gr.Row():
126
- qr_Logo_radio = gr.Radio(["tripleS", "None"], label="tripleS Logo", value="None",
127
- interactive=True)
128
- with gr.Group():
129
- right_btn = gr.Checkbox(label="Add Rights", value=False, interactive=True)
130
- with gr.Group():
131
- rounded_back = gr.Checkbox(label="Rounded", value=True, interactive=True)
132
- with gr.Group():
133
- generate_btn_back = gr.Button(value="Generate")
134
-
135
- with gr.Column():
136
- outputs2 = gr.Image(label="Edited Image", scale=10)
137
-
138
- with gr.Tab("Export") as ex:
139
- with gr.Row():
140
- ex_img_f = gr.Image(label="Front", type="pil", interactive=False)
141
- ex_file_f = gr.File(render=True, visible=False)
142
- ex_img_b = gr.Image(label="Back", type="pil", interactive=False)
143
- with gr.Column():
144
- with gr.Group():
145
- with gr.Row():
146
- ex_hide_blur = gr.Checkbox(label="Blur")
147
- ex_hide_blur_range = gr.Slider(1, 20, 5, label="Blur Range", step=1, interactive=False, scale=10)
148
-
149
- ex_hide_blur.select(fns.ex_blur, ex_hide_blur, ex_hide_blur_range)
150
-
151
- with gr.Group():
152
- watermark = gr.Textbox(label="Add watermark")
153
-
154
- ex_gen_file_count = gr.Radio(["One File", "Two Files"], label="Export Type", value="One File")
155
- ex_btn = gr.Button(value="Export")
156
- with gr.Row():
157
- ex_img_f_out = gr.Image(label="Front", interactive=False)
158
- ex_img_b_out = gr.Image(label="Back", visible=False, interactive=False)
159
-
160
-
161
-
162
- with gr.Tab("Dev"):
163
- dev_txt = gr.Textbox(label="Developer Key", visible=True, interactive=True)
164
- dev_btn = gr.Button(value="Do", visible=True, interactive=True)
165
- dev_out = gr.Textbox()
166
- dev_drop = gr.Dropdown(visible=False, interactive=False)
167
- dev_file = gr.File(visible=False, interactive=False)
168
- dev_btn2 = gr.Button(visible=False, interactive=False)
169
- dev_btn3 = gr.Button(visible=False, interactive=False)
170
-
171
- dev_btn2.click(fn=fns.dev2, outputs=dev_out)
172
- dev_btn3.click(fn=fns.dev3, inputs=dev_drop, outputs=dev_file)
173
- dev_btn.click(fns.dev, dev_txt, [dev_out, dev_drop, dev_file, dev_btn2, dev_btn3])
174
- gr.Markdown(
175
- """
176
- ## Made by
177
- # Discord : hj_sss (Can DM)
178
- # Cosmo : ILoveYouyeon
179
- ### this site is free But I hope anyone can support the objekt to my Cosmo
180
- """)
181
-
182
- generate_btn.click(fn=generate.sorting,
183
- inputs=[img_type, img_static, img_dynamic_file, obj_color, obj_color_picker, ai_num, txt_color,
184
- txt_color_picker, member_name_dropdown, group_name_radio, group_name_txt, obj_num,
185
- obj_alphabet, obj_alphabet_txt, obj_serial, rounded], outputs=[edited_img, ex_img_f, ex_file_f])
186
-
187
- ex_gen_file_count.change(fns.ex_gen_count, ex_gen_file_count, ex_img_b_out)
188
- rounded.change(fns.rounded_sync, rounded, rounded_back)
189
- rounded_back.change(fns.rounded_sync, rounded_back, rounded)
190
-
191
- change_ai.click(fns.change_ran, obj_color, ai_num)
192
-
193
- generate_btn_back.click(fn=generate.back,
194
- inputs=[obj_color, obj_color_picker, ai_num, txt_color, txt_color_picker, group_name_radio,
195
- group_name_txt, member_name_dropdown, obj_num, obj_alphabet, obj_alphabet_txt,
196
- obj_serial, obj_outline_color, obj_outline_color_picker, logo_radio, class_radio,
197
- class_txt, season_radio, season_txt, season_txt_outline, sign, qr_url_dropdown,
198
- qr_Logo_radio, right_btn, rounded_back], outputs=[outputs2, ex_img_b])
199
-
200
- back_tab.select(fn=generate.back,
201
- inputs=[obj_color, obj_color_picker, ai_num, txt_color, txt_color_picker, group_name_radio,
202
- group_name_txt, member_name_dropdown, obj_num, obj_alphabet, obj_alphabet_txt, obj_serial,
203
- obj_outline_color, obj_outline_color_picker, logo_radio, class_radio, class_txt,
204
- season_radio, season_txt, season_txt_outline, sign, qr_url_dropdown, qr_Logo_radio,
205
- right_btn, rounded_back], outputs=[preview, ex_img_b])
206
-
207
- ex_btn.click(fn=generate.ex_gen, inputs=[ex_img_f, ex_file_f, ex_img_b, ex_gen_file_count, ex_hide_blur, ex_hide_blur_range, watermark], outputs=[ex_img_f_out, ex_img_b_out])
208
-
209
- if __name__ == "__main__":
210
- print("http://localhost:7860")
211
- demo.launch(server_name="0.0.0.0")
212
-