Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3069,11 +3069,10 @@ init_user_db()
|
|
| 3069 |
|
| 3070 |
USER_DB = {
|
| 3071 |
"jin2li@rebom.kr": "qwer0515!",
|
| 3072 |
-
|
| 3073 |
# ์ฌ์ฉ์ ์ถ๊ฐ ์์:
|
| 3074 |
# "yubin.p@rebom.kr": "์ํ๋๋น๋ฐ๋ฒํธ",
|
| 3075 |
-
|
| 3076 |
-
}
|
| 3077 |
|
| 3078 |
|
| 3079 |
def auth_fn(username, password):
|
|
@@ -3179,10 +3178,46 @@ def process_single_ingredient_with_auth(user, countries, single_query, single_am
|
|
| 3179 |
)
|
| 3180 |
|
| 3181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3182 |
with gr.Blocks(css=custom_css) as demo:
|
| 3183 |
current_user = gr.State({})
|
| 3184 |
session_user_json = gr.Textbox(visible=False, elem_id="rebom_session_user_json")
|
| 3185 |
-
restore_session_btn = gr.Button("restore session",
|
| 3186 |
|
| 3187 |
gr.Markdown("# ๐ reBom")
|
| 3188 |
gr.HTML("""
|
|
@@ -3342,18 +3377,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 3342 |
variant="secondary",
|
| 3343 |
)
|
| 3344 |
|
| 3345 |
-
with gr.Tab("
|
| 3346 |
-
gr.Markdown("## ๐ ๋ก๊ทธ์ธ")
|
| 3347 |
-
gr.Markdown("์น์ธ๋ ๊ณ์ ๋ง ์คํฌ๋ฆฌ๋ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.")
|
| 3348 |
-
|
| 3349 |
-
login_email = gr.Textbox(label="๋ฉ์ผ ์ฃผ์", placeholder="example@rebom.kr")
|
| 3350 |
-
remember_email = gr.Checkbox(label="์์ด๋ ์ ์ฅ", value=False)
|
| 3351 |
-
login_password = gr.Textbox(label="๋น๋ฐ๋ฒํธ", type="password")
|
| 3352 |
-
login_btn = gr.Button("๋ก๊ทธ์ธ", variant="primary")
|
| 3353 |
-
logout_btn = gr.Button("๋ก๊ทธ์์", variant="secondary")
|
| 3354 |
-
login_status = gr.Textbox(label="๋ก๊ทธ์ธ ์ํ", interactive=False, lines=3)
|
| 3355 |
-
|
| 3356 |
-
with gr.Tab("๐ ๊ณ์ ๋ฑ๋ก์ ๊ด๋ฆฌ์์๊ฒ ์์ฒญ", visible=False):
|
| 3357 |
gr.Markdown("## ๐ ๊ณ์ ๋ฑ๋ก์ ๊ด๋ฆฌ์์๊ฒ ์์ฒญ")
|
| 3358 |
gr.Markdown("ํ, ์ด๋ฆ, ๋ฉ์ผ ์ฃผ์, ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ฉด ๊ด๋ฆฌ์ ์น์ธ ํ ์ฌ์ดํธ ์ด์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค.")
|
| 3359 |
|
|
@@ -3425,7 +3449,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 3425 |
outputs=[single_df_out,single_msg_out],
|
| 3426 |
)
|
| 3427 |
|
| 3428 |
-
with gr.Tab("๐ ํ์ ์น์ธ ๊ด๋ฆฌ"
|
| 3429 |
gr.Markdown("## ๐ ํ์ ์น์ธ ๊ด๋ฆฌ")
|
| 3430 |
gr.Markdown("๊ด๋ฆฌ์ ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธํ ๊ฒฝ์ฐ์๋ง ์น์ธ/๊ฑฐ์ ํ ์ ์์ต๋๋ค.")
|
| 3431 |
|
|
|
|
| 3069 |
|
| 3070 |
USER_DB = {
|
| 3071 |
"jin2li@rebom.kr": "qwer0515!",
|
| 3072 |
+
"jkh@rebom.kr": "rebom123!"
|
| 3073 |
# ์ฌ์ฉ์ ์ถ๊ฐ ์์:
|
| 3074 |
# "yubin.p@rebom.kr": "์ํ๋๋น๋ฐ๋ฒํธ",
|
| 3075 |
+
}
|
|
|
|
| 3076 |
|
| 3077 |
|
| 3078 |
def auth_fn(username, password):
|
|
|
|
| 3178 |
)
|
| 3179 |
|
| 3180 |
|
| 3181 |
+
|
| 3182 |
+
# ============================================================
|
| 3183 |
+
# ๋ก๊ทธ์ธ ์ธ์ฆ
|
| 3184 |
+
# - Gradio ๊ธฐ๋ณธ ๋ก๊ทธ์ธ์ฐฝ ์ฌ์ฉ
|
| 3185 |
+
# - ์๋ USER_DB์ ๋ฉ์ผ/๋น๋ฐ๋ฒํธ๋ฅผ ์ง์ ๋ฑ๋ก
|
| 3186 |
+
# ============================================================
|
| 3187 |
+
|
| 3188 |
+
USER_DB = {
|
| 3189 |
+
"jin2li@rebom.kr": "qwer0515!",
|
| 3190 |
+
|
| 3191 |
+
# ์ฌ์ฉ์ ๋ฑ๋ก ์์:
|
| 3192 |
+
# "yubin.p@rebom.kr": "123456!",
|
| 3193 |
+
# "jkh@rebom.kr": "rebom123!",
|
| 3194 |
+
}
|
| 3195 |
+
|
| 3196 |
+
|
| 3197 |
+
def auth_fn(username, password):
|
| 3198 |
+
username = str(username).strip().lower()
|
| 3199 |
+
password = str(password).strip()
|
| 3200 |
+
return USER_DB.get(username) == password
|
| 3201 |
+
|
| 3202 |
+
|
| 3203 |
+
def process_with_auth(user, countries, file, product_name="", use_mfds_live=False, live_max_terms=30, live_headless=True):
|
| 3204 |
+
return process(countries, file, product_name, use_mfds_live, live_max_terms, live_headless)
|
| 3205 |
+
|
| 3206 |
+
|
| 3207 |
+
def process_single_ingredient_with_auth(user, countries, single_query, single_amount, single_function, single_use_mfds_live=False):
|
| 3208 |
+
return process_single_ingredient(
|
| 3209 |
+
countries,
|
| 3210 |
+
single_query,
|
| 3211 |
+
single_amount,
|
| 3212 |
+
single_function,
|
| 3213 |
+
single_use_mfds_live,
|
| 3214 |
+
)
|
| 3215 |
+
|
| 3216 |
+
|
| 3217 |
with gr.Blocks(css=custom_css) as demo:
|
| 3218 |
current_user = gr.State({})
|
| 3219 |
session_user_json = gr.Textbox(visible=False, elem_id="rebom_session_user_json")
|
| 3220 |
+
restore_session_btn = gr.Button("restore session", elem_id="rebom_restore_session_btn_disabled")
|
| 3221 |
|
| 3222 |
gr.Markdown("# ๐ reBom")
|
| 3223 |
gr.HTML("""
|
|
|
|
| 3377 |
variant="secondary",
|
| 3378 |
)
|
| 3379 |
|
| 3380 |
+
with gr.Tab("๐ ๊ณ์ ๋ฑ๋ก์ ๊ด๋ฆฌ์์๊ฒ ์์ฒญ"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3381 |
gr.Markdown("## ๐ ๊ณ์ ๋ฑ๋ก์ ๊ด๋ฆฌ์์๊ฒ ์์ฒญ")
|
| 3382 |
gr.Markdown("ํ, ์ด๋ฆ, ๋ฉ์ผ ์ฃผ์, ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ฉด ๊ด๋ฆฌ์ ์น์ธ ํ ์ฌ์ดํธ ์ด์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค.")
|
| 3383 |
|
|
|
|
| 3449 |
outputs=[single_df_out,single_msg_out],
|
| 3450 |
)
|
| 3451 |
|
| 3452 |
+
with gr.Tab("๐ ํ์ ์น์ธ ๊ด๋ฆฌ") as admin_tab:
|
| 3453 |
gr.Markdown("## ๐ ํ์ ์น์ธ ๊ด๋ฆฌ")
|
| 3454 |
gr.Markdown("๊ด๋ฆฌ์ ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธํ ๊ฒฝ์ฐ์๋ง ์น์ธ/๊ฑฐ์ ํ ์ ์์ต๋๋ค.")
|
| 3455 |
|