jin2li commited on
Commit
05c8f43
ยท
verified ยท
1 Parent(s): f01adb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -43
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # ============================================================
2
  # reBom Regulatory Screening AI - Fast Grounded Fixed Version
3
  # - ๊ตญ๊ฐ€/์ฑ„๋„ ํด๋” ์ž๋™ ์ธ์‹
@@ -3164,6 +3165,42 @@ def process_single_ingredient_with_auth(user, countries, single_query, single_am
3164
  )
3165
 
3166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3167
  with gr.Blocks(css=custom_css) as demo:
3168
  current_user = gr.State({})
3169
  session_user_json = gr.Textbox(visible=False, elem_id="rebom_session_user_json")
@@ -3362,7 +3399,7 @@ with gr.Blocks(css=custom_css) as demo:
3362
  outputs=signup_status,
3363
  )
3364
 
3365
- with gr.Tab("๐Ÿš€ ์Šคํฌ๋ฆฌ๋‹") as screening_tab:
3366
  gr.Markdown("## ๐Ÿš€ ์ „์„ฑ๋ถ„ ์Šคํฌ๋ฆฌ๋‹")
3367
  gr.Markdown("๋กœ๊ทธ์ธ ๋ฐ ๊ด€๋ฆฌ์ž ์Šน์ธ ์™„๋ฃŒ ํ›„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.")
3368
 
@@ -3387,7 +3424,7 @@ with gr.Blocks(css=custom_css) as demo:
3387
  outputs=[df_out,file_out,msg_out],
3388
  )
3389
 
3390
- with gr.Tab("๐Ÿ”Ž ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰") as single_tab:
3391
  gr.Markdown("## ๐Ÿ”Ž ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰")
3392
  gr.Markdown("๋กœ๊ทธ์ธ ๋ฐ ๊ด€๋ฆฌ์ž ์Šน์ธ ์™„๋ฃŒ ํ›„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.")
3393
 
@@ -3461,47 +3498,6 @@ with gr.Blocks(css=custom_css) as demo:
3461
  inputs=[current_user, target_email],
3462
  outputs=[users_table, admin_status],
3463
  )
3464
-
3465
- restore_session_btn.click(
3466
- fn=restore_user_session_from_json,
3467
- inputs=[session_user_json],
3468
- outputs=[
3469
- current_user,
3470
- login_status,
3471
- screening_tab,
3472
- single_tab,
3473
- admin_tab,
3474
- ],
3475
- )
3476
-
3477
- login_btn.click(
3478
- fn=login_user_with_ui_and_session,
3479
- inputs=[login_email, login_password],
3480
- outputs=[
3481
- current_user,
3482
- login_status,
3483
- screening_tab,
3484
- single_tab,
3485
- admin_tab,
3486
- session_user_json,
3487
- ],
3488
- )
3489
-
3490
- logout_btn.click(
3491
- fn=logout_user_with_ui_and_session,
3492
- inputs=[],
3493
- outputs=[
3494
- current_user,
3495
- login_status,
3496
- screening_tab,
3497
- single_tab,
3498
- admin_tab,
3499
- session_user_json,
3500
- ],
3501
- )
3502
-
3503
-
3504
-
3505
  try:
3506
  demo.launch(
3507
  auth=auth_fn,
 
1
+ # APP_PATCH_NOTE_LIMIT_POSITIVE_MFDS = "Positive List ํ•œ๋„ํ™•์ธ + MFDS ์ œํ•œ ํŒŒ์‹ฑ ๋ณด๊ฐ• ์ ์šฉ๋ณธ"
2
  # ============================================================
3
  # reBom Regulatory Screening AI - Fast Grounded Fixed Version
4
  # - ๊ตญ๊ฐ€/์ฑ„๋„ ํด๋” ์ž๋™ ์ธ์‹
 
3165
  )
3166
 
3167
 
3168
+
3169
+ # ============================================================
3170
+ # ๋กœ๊ทธ์ธ ์ธ์ฆ
3171
+ # - Gradio ๊ธฐ๋ณธ ๋กœ๊ทธ์ธ์ฐฝ ์‚ฌ์šฉ
3172
+ # - USER_DB์— ์—ฌ๋Ÿฌ ์•„์ด๋””/๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ง์ ‘ ๋“ฑ๋ก
3173
+ # ============================================================
3174
+
3175
+ USER_DB = {
3176
+ "jin2li@rebom.kr": "qwer0515!",
3177
+
3178
+ # ์‚ฌ์šฉ์ž ์ถ”๊ฐ€ ์˜ˆ์‹œ:
3179
+ # "yubin.p@rebom.kr": "์›ํ•˜๋Š”๋น„๋ฐ€๋ฒˆํ˜ธ",
3180
+ # "jkh@rebom.kr": "rebom123!",
3181
+ }
3182
+
3183
+
3184
+ def auth_fn(username, password):
3185
+ username = str(username).strip().lower()
3186
+ password = str(password).strip()
3187
+ return USER_DB.get(username) == password
3188
+
3189
+
3190
+ def process_with_auth(user, countries, file, product_name="", use_mfds_live=False, live_max_terms=30, live_headless=True):
3191
+ return process(countries, file, product_name, use_mfds_live, live_max_terms, live_headless)
3192
+
3193
+
3194
+ def process_single_ingredient_with_auth(user, countries, single_query, single_amount, single_function, single_use_mfds_live=False):
3195
+ return process_single_ingredient(
3196
+ countries,
3197
+ single_query,
3198
+ single_amount,
3199
+ single_function,
3200
+ single_use_mfds_live,
3201
+ )
3202
+
3203
+
3204
  with gr.Blocks(css=custom_css) as demo:
3205
  current_user = gr.State({})
3206
  session_user_json = gr.Textbox(visible=False, elem_id="rebom_session_user_json")
 
3399
  outputs=signup_status,
3400
  )
3401
 
3402
+ with gr.Tab("๐Ÿš€ ์Šคํฌ๋ฆฌ๋‹", visible=True) as screening_tab:
3403
  gr.Markdown("## ๐Ÿš€ ์ „์„ฑ๋ถ„ ์Šคํฌ๋ฆฌ๋‹")
3404
  gr.Markdown("๋กœ๊ทธ์ธ ๋ฐ ๊ด€๋ฆฌ์ž ์Šน์ธ ์™„๋ฃŒ ํ›„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.")
3405
 
 
3424
  outputs=[df_out,file_out,msg_out],
3425
  )
3426
 
3427
+ with gr.Tab("๐Ÿ”Ž ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰", visible=True) as single_tab:
3428
  gr.Markdown("## ๐Ÿ”Ž ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰")
3429
  gr.Markdown("๋กœ๊ทธ์ธ ๋ฐ ๊ด€๋ฆฌ์ž ์Šน์ธ ์™„๋ฃŒ ํ›„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.")
3430
 
 
3498
  inputs=[current_user, target_email],
3499
  outputs=[users_table, admin_status],
3500
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3501
  try:
3502
  demo.launch(
3503
  auth=auth_fn,