Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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,
|