tripleS-Dev commited on
Commit
eba98a5
β€’
1 Parent(s): 9f72236

update V1.2.0L Beta

Browse files
Files changed (3) hide show
  1. login_discord.py +5 -5
  2. main.py +32 -20
  3. rekord.py +30 -0
login_discord.py CHANGED
@@ -5,7 +5,7 @@ from urllib.parse import urlparse, parse_qs
5
  def id_check(request: gr.Request):
6
  param = str(request.query_params)
7
  if not "code=" in param:
8
- return "Login to Discord", gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "Other color", "AI Color"], label="Objekt Color", value="Cream01")
9
 
10
  code = param.split('code=')
11
  print(code[1])
@@ -14,11 +14,11 @@ def id_check(request: gr.Request):
14
  if user_id == None:
15
  return "Login to Discord", gr.Tab(visible=False)
16
  if user_id == "412827396027187211":
17
- return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=True), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "OMA", "Other color", "AI Color"], label="Objekt Color", value="Divine01")
18
  if user_id == "676049087300239369":
19
- return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "OMA", "Other color", "AI Color"],label="Objekt Color", value="Divine01")
20
  print(user_id)
21
- return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "Other color", "AI Color"], label="Objekt Color", value="Cream01")
22
  #1
23
 
24
  def get_discord_user_profile(code):
@@ -62,7 +62,7 @@ def get_discord_user_profile(code):
62
  except requests.exceptions.RequestException as e:
63
  print("Error to login")
64
  # print(str(e)) # 였λ₯˜ λ‚΄μš© 좜λ ₯을 μ›ν•œλ‹€λ©΄ 주석 ν•΄μ œ
65
- return None, None, None, None # 였λ₯˜ λ°œμƒμ‹œ None λ°˜ν™˜
66
 
67
  # μ‚¬μš© 예:
68
  client_id = "1239473790732472370"
 
5
  def id_check(request: gr.Request):
6
  param = str(request.query_params)
7
  if not "code=" in param:
8
+ return "Login to Discord", gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "Other color", "AI Color"], label="Objekt Color", value="Cream01"), gr.Tab(visible=False)
9
 
10
  code = param.split('code=')
11
  print(code[1])
 
14
  if user_id == None:
15
  return "Login to Discord", gr.Tab(visible=False)
16
  if user_id == "412827396027187211":
17
+ return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=True), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "OMA", "Other color", "AI Color"], label="Objekt Color", value="Divine01"), gr.Tab(visible=True)
18
  if user_id == "676049087300239369":
19
+ return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "OMA", "Other color", "AI Color"],label="Objekt Color", value="Divine01"), gr.Tab(visible=True)
20
  print(user_id)
21
+ return gr.Button(value=username, icon=avatar_url, link=redirect_uri), gr.Tab(visible=False), gr.Radio(["Atom01", "Binary01", "Cream01", "Divine01", "Special", "Other color", "AI Color"], label="Objekt Color", value="Cream01"), gr.Tab(visible=False)
22
  #1
23
 
24
  def get_discord_user_profile(code):
 
62
  except requests.exceptions.RequestException as e:
63
  print("Error to login")
64
  # print(str(e)) # 였λ₯˜ λ‚΄μš© 좜λ ₯을 μ›ν•œλ‹€λ©΄ 주석 ν•΄μ œ
65
+ return None, None, None # 였λ₯˜ λ°œμƒμ‹œ None λ°˜ν™˜
66
 
67
  # μ‚¬μš© 예:
68
  client_id = "1239473790732472370"
main.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import fns
3
  import generate
4
  import login_discord
 
5
 
6
  js_func = """
7
  function refresh() {
@@ -17,30 +18,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo: # , js=js_func
17
  with gr.Column():
18
  with gr.Row():
19
  gr.Markdown(
20
- """
21
- # Objektify
22
- """)
23
  login = gr.Button(size="sm", value="Login to Discord", link="https://discord.com/oauth2/authorize?client_id=1239473790732472370&response_type=code&redirect_uri=https%3A%2F%2Fchohj06ms-objektify2.hf.space%2F&scope=identify", scale=0)
24
 
25
  gr.Markdown(
26
  """
27
- ### custom objekt
28
  ## Input image and Select Options
29
  """
30
  )
31
 
32
- with gr.Tab("Event"):
33
- with gr.Row():
34
- with gr.Column():
35
- event_img = gr.Image(label="Image", interactive=True, sources=['upload', 'clipboard'], type="pil", visible=True, scale=10)
36
- with gr.Column():
37
- event_radio = gr.Radio(["White", "Black"], value="White", interactive=True, label="Font")
38
- event_txt = gr.Textbox(label="Girls Never ____", placeholder="Die")
39
- event_position = gr.Slider(label="Y position", maximum=100, minimum=0)
40
- event_generate = gr.Button(value="Generate")
41
- with gr.Column():
42
- event_output = gr.Gallery(label="output", interactive=False, type="pil", visible=True, scale=10, object_fit="scale-down")
43
- event_generate.click(fn=generate.event, inputs=[event_img, event_radio, event_txt, event_position], outputs=event_output)
44
 
45
 
46
  with gr.Tab("Front"):
@@ -185,8 +175,24 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo: # , js=js_func
185
  with gr.Row():
186
  ex_img_f_out = gr.Image(label="Front", interactive=False)
187
  ex_img_b_out = gr.Image(label="Back", visible=False, interactive=False)
188
-
189
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
  with gr.Tab("Dev", visible=False) as dev:
192
 
@@ -206,7 +212,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo: # , js=js_func
206
  dev_btn.click(fns.dev, outputs=[dev_out, dev_drop])
207
  gr.Markdown(
208
  """
209
- ## support email : ssscosmotest@gmail.com
 
 
 
 
 
 
210
  """)
211
 
212
  generate_btn.click(fn=generate.sorting,
@@ -235,7 +247,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo: # , js=js_func
235
  right_btn, rounded_back], outputs=[preview, ex_img_b])
236
 
237
  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])
238
- demo.load(fn=login_discord.id_check, outputs=[login, dev, obj_color])
239
 
240
 
241
 
 
2
  import fns
3
  import generate
4
  import login_discord
5
+ import rekord
6
 
7
  js_func = """
8
  function refresh() {
 
18
  with gr.Column():
19
  with gr.Row():
20
  gr.Markdown(
21
+ """
22
+ # Objektify
23
+ """)
24
  login = gr.Button(size="sm", value="Login to Discord", link="https://discord.com/oauth2/authorize?client_id=1239473790732472370&response_type=code&redirect_uri=https%3A%2F%2Fchohj06ms-objektify2.hf.space%2F&scope=identify", scale=0)
25
 
26
  gr.Markdown(
27
  """
28
+ ### [Join objektify official discord!](https://discord.gg/K44Ka83BYT)
29
  ## Input image and Select Options
30
  """
31
  )
32
 
33
+
 
 
 
 
 
 
 
 
 
 
 
34
 
35
 
36
  with gr.Tab("Front"):
 
175
  with gr.Row():
176
  ex_img_f_out = gr.Image(label="Front", interactive=False)
177
  ex_img_b_out = gr.Image(label="Back", visible=False, interactive=False)
178
+ with gr.Tab("Event"):
179
+ with gr.Row():
180
+ with gr.Column():
181
+ event_img = gr.Image(label="Image", interactive=True, sources=['upload', 'clipboard'], type="pil", visible=True, scale=10)
182
+ with gr.Column():
183
+ event_radio = gr.Radio(["White", "Black"], value="White", interactive=True, label="Font")
184
+ event_txt = gr.Textbox(label="Girls Never ____", placeholder="Die")
185
+ event_position = gr.Slider(label="Y position", maximum=100, minimum=0)
186
+ event_generate = gr.Button(value="Generate")
187
+ with gr.Column():
188
+ event_output = gr.Gallery(label="output", interactive=False, type="pil", visible=True, scale=10, object_fit="scale-down")
189
+ event_generate.click(fn=generate.event, inputs=[event_img, event_radio, event_txt, event_position], outputs=event_output)
190
+ with gr.Tab("ReKord", visible=False) as rec:
191
+ rekord_img = gr.Image(type="filepath")
192
+ rekord_member = gr.Slider(minimum=1, maximum=24, step=1)
193
+ rekord_submit = gr.Button()
194
+ rekord_out = gr.Textbox()
195
+ rekord_submit.click(fn=rekord.upload, inputs=[rekord_img, rekord_member], outputs=rekord_out)
196
 
197
  with gr.Tab("Dev", visible=False) as dev:
198
 
 
212
  dev_btn.click(fns.dev, outputs=[dev_out, dev_drop])
213
  gr.Markdown(
214
  """
215
+ ## Made by
216
+ # Discord : hj_sss
217
+ ## official discord
218
+ ### [Click here and Join](https://discord.gg/K44Ka83BYT)
219
+
220
+ ### Members or group presets can be added and advertised. Check the official discord.
221
+ #### Check the objektify official discord for licensing and other data processing policies.
222
  """)
223
 
224
  generate_btn.click(fn=generate.sorting,
 
247
  right_btn, rounded_back], outputs=[preview, ex_img_b])
248
 
249
  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])
250
+ demo.load(fn=login_discord.id_check, outputs=[login, dev, obj_color, rec])
251
 
252
 
253
 
rekord.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+
4
+ def upload(img_path, member):
5
+ member = str(member)
6
+ url = "https://api.cosmo.fans/rekord/v1/post/"
7
+ headers = {
8
+ "accept": "application/json, text/plain, */*",
9
+ "authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoiYWNjZXNzIiwiaWF0IjoxNzE2MTQyMTU0LCJleHAiOjE3MTY3NDY5NTQsInN1YiI6IjE0MzMxMCJ9.cO2BTL-p4glxxpH84Kb2vFc3xTiJHBJql_ZNDyBMXlg",
10
+ "appversion": "2.7.8",
11
+ "accept-language": "ko-KR,ko;q=0.9",
12
+ "accept-encoding": "gzip, deflate, br",
13
+ "x-request-id": "246cc82d-889a-461a-a6ea-74bda45fdf72",
14
+ "deviceid": "iPad12,1",
15
+ "user-agent": "cosmo/78 CFNetwork/1494.0.7 Darwin/23.4.0",
16
+ }
17
+
18
+ # Multipart form data
19
+ data = {
20
+ "artistMemberIds": "5",
21
+ "tagId": member
22
+ }
23
+
24
+ files = {
25
+ "file": ("6F98DCF5-060A-449E-BBE0-F4A3ECD80C77.png", open(img_path, "rb"), "image/png"),
26
+ }
27
+
28
+ response = requests.post(url, headers=headers, data=data, files=files)
29
+
30
+ return f"{response.status_code}\n{response.text}"