tripleS-Dev commited on
Commit
100d5f6
โ€ข
1 Parent(s): 93cd768

update V1.2.0L Beta

Browse files

-Rekord member dropdown

Files changed (3) hide show
  1. fn.py +17 -1
  2. main.py +5 -1
  3. rekord.py +2 -1
fn.py CHANGED
@@ -50,4 +50,20 @@ def remove(filename):
50
  # ํŒŒ์ผ์ด zip ํŒŒ์ผ์ธ์ง€ ํ™•์ธ
51
  if filename.endswith('.zip'):
52
  # ํŒŒ์ผ ์‚ญ์ œ
53
- os.remove(file_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  # ํŒŒ์ผ์ด zip ํŒŒ์ผ์ธ์ง€ ํ™•์ธ
51
  if filename.endswith('.zip'):
52
  # ํŒŒ์ผ ์‚ญ์ œ
53
+ os.remove(file_path)
54
+
55
+
56
+ def transform_number(n):
57
+ if n < 1 or n > 29:
58
+ raise ValueError("์ž…๋ ฅ ๊ฐ’์€ 1๋ถ€ํ„ฐ 29 ์‚ฌ์ด์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค.")
59
+
60
+ if 1 <= n <= 14:
61
+ return n
62
+ elif n == 15:
63
+ return 19
64
+ elif 16 <= n <= 24:
65
+ return n + 5
66
+ elif 25 <= n <= 28:
67
+ return n - 10
68
+ elif n == 29:
69
+ return 20
main.py CHANGED
@@ -189,7 +189,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo: # , js=js_func
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=50, 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)
 
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
+
193
+ rekord_member = gr.Dropdown(
194
+ ["SeoYeon", "HyeRin", "JiWoo", "ChaeYeon", "YooYeon", "SooMin", "NaKyoung", "YuBin", "Kaede",
195
+ "DaHyun", "Kotone", "YeonJi", "Nien", "SoHyun", "Xinyu", "Mayu", "Lynn", "JooBin", "HaYeon",
196
+ "ShiOn", "ChaeWon", "Sullin", "SeoAh", "JiYeon", "HeeJin", "KimLip", "JinSoul", "Choerry", "HaSeul"], label="Sign", type='index')
197
  rekord_submit = gr.Button()
198
  rekord_out = gr.Textbox()
199
  rekord_submit.click(fn=rekord.upload, inputs=[rekord_img, rekord_member], outputs=rekord_out)
rekord.py CHANGED
@@ -1,9 +1,10 @@
1
  import requests
 
2
 
3
 
4
  def upload(img_path, member):
5
 
6
- member = str(member)
7
 
8
  url = "https://api.cosmo.fans/rekord/v1/post/"
9
  headers = {
 
1
  import requests
2
+ import fn
3
 
4
 
5
  def upload(img_path, member):
6
 
7
+ member = fn.transform_number(member)
8
 
9
  url = "https://api.cosmo.fans/rekord/v1/post/"
10
  headers = {