Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2728,12 +2728,11 @@ def process_single_ingredient_with_auth(user, countries, single_query, single_am
|
|
| 2728 |
USER_DB = {
|
| 2729 |
"jin2li@rebom.kr": "qwer0515!",
|
| 2730 |
"jkh@rebom.kr": "rebom123!"
|
| 2731 |
-
"admin : rebom123!"
|
| 2732 |
|
| 2733 |
# ์ฌ์ฉ์ ์ถ๊ฐ ์์:
|
| 2734 |
# "yubin.p@rebom.kr": "์ํ๋๋น๋ฐ๋ฒํธ",
|
| 2735 |
-
|
| 2736 |
-
}
|
| 2737 |
|
| 2738 |
|
| 2739 |
def auth_fn(username, password):
|
|
@@ -2907,9 +2906,6 @@ def process_single_ingredient_with_auth(user, countries, single_query, single_am
|
|
| 2907 |
|
| 2908 |
with gr.Blocks(css=custom_css) as demo:
|
| 2909 |
current_user = gr.State({})
|
| 2910 |
-
session_user_json = gr.Textbox(visible=False, elem_id="rebom_session_user_json")
|
| 2911 |
-
restore_session_btn = gr.Button("restore session", elem_id="rebom_restore_session_btn_disabled")
|
| 2912 |
-
|
| 2913 |
gr.Markdown("# ๐ reBom")
|
| 2914 |
gr.HTML("""
|
| 2915 |
<script>
|
|
@@ -2987,76 +2983,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 2987 |
</script>
|
| 2988 |
|
| 2989 |
|
| 2990 |
-
<script>
|
| 2991 |
-
(function () {
|
| 2992 |
-
const USER_KEY = "rebom_current_user_session";
|
| 2993 |
-
|
| 2994 |
-
function getTextareaByElemId(id) {
|
| 2995 |
-
const root = document.getElementById(id);
|
| 2996 |
-
if (!root) return null;
|
| 2997 |
-
return root.querySelector("textarea, input");
|
| 2998 |
-
}
|
| 2999 |
-
|
| 3000 |
-
function setGradioValue(el, value) {
|
| 3001 |
-
if (!el) return;
|
| 3002 |
-
el.value = value;
|
| 3003 |
-
el.dispatchEvent(new Event("input", { bubbles: true }));
|
| 3004 |
-
el.dispatchEvent(new Event("change", { bubbles: true }));
|
| 3005 |
-
}
|
| 3006 |
-
|
| 3007 |
-
function findButtonByElemId(id) {
|
| 3008 |
-
const root = document.getElementById(id);
|
| 3009 |
-
if (!root) return null;
|
| 3010 |
-
return root.querySelector("button");
|
| 3011 |
-
}
|
| 3012 |
-
|
| 3013 |
-
function bindSessionSave() {
|
| 3014 |
-
const box = getTextareaByElemId("rebom_session_user_json");
|
| 3015 |
-
if (!box || box.dataset.rebomSessionBound === "1") return;
|
| 3016 |
-
|
| 3017 |
-
box.dataset.rebomSessionBound = "1";
|
| 3018 |
|
| 3019 |
-
const save = function () {
|
| 3020 |
-
const value = (box.value || "").trim();
|
| 3021 |
-
if (value) {
|
| 3022 |
-
sessionStorage.setItem(USER_KEY, value);
|
| 3023 |
-
} else {
|
| 3024 |
-
sessionStorage.removeItem(USER_KEY);
|
| 3025 |
-
}
|
| 3026 |
-
};
|
| 3027 |
-
|
| 3028 |
-
box.addEventListener("input", save);
|
| 3029 |
-
box.addEventListener("change", save);
|
| 3030 |
-
save();
|
| 3031 |
-
}
|
| 3032 |
-
|
| 3033 |
-
function restoreOnce() {
|
| 3034 |
-
if (window.__rebomSessionRestored) return;
|
| 3035 |
-
|
| 3036 |
-
const saved = sessionStorage.getItem(USER_KEY);
|
| 3037 |
-
if (!saved) return;
|
| 3038 |
-
|
| 3039 |
-
const box = getTextareaByElemId("rebom_session_user_json");
|
| 3040 |
-
const btn = findButtonByElemId("rebom_restore_session_btn_disabled_never");
|
| 3041 |
-
|
| 3042 |
-
if (!box || !btn) return;
|
| 3043 |
-
|
| 3044 |
-
window.__rebomSessionRestored = true;
|
| 3045 |
-
setGradioValue(box, saved);
|
| 3046 |
-
setTimeout(function () {
|
| 3047 |
-
btn.click();
|
| 3048 |
-
}, 500);
|
| 3049 |
-
}
|
| 3050 |
-
|
| 3051 |
-
function boot() {
|
| 3052 |
-
bindSessionSave();
|
| 3053 |
-
restoreOnce();
|
| 3054 |
-
}
|
| 3055 |
-
|
| 3056 |
-
setInterval(boot, 800);
|
| 3057 |
-
document.addEventListener("DOMContentLoaded", boot);
|
| 3058 |
-
})();
|
| 3059 |
-
</script>
|
| 3060 |
|
| 3061 |
""")
|
| 3062 |
gr.Markdown("### Screening")
|
|
|
|
| 2728 |
USER_DB = {
|
| 2729 |
"jin2li@rebom.kr": "qwer0515!",
|
| 2730 |
"jkh@rebom.kr": "rebom123!"
|
| 2731 |
+
"admin" : "rebom123!"
|
| 2732 |
|
| 2733 |
# ์ฌ์ฉ์ ์ถ๊ฐ ์์:
|
| 2734 |
# "yubin.p@rebom.kr": "์ํ๋๋น๋ฐ๋ฒํธ",
|
| 2735 |
+
}
|
|
|
|
| 2736 |
|
| 2737 |
|
| 2738 |
def auth_fn(username, password):
|
|
|
|
| 2906 |
|
| 2907 |
with gr.Blocks(css=custom_css) as demo:
|
| 2908 |
current_user = gr.State({})
|
|
|
|
|
|
|
|
|
|
| 2909 |
gr.Markdown("# ๐ reBom")
|
| 2910 |
gr.HTML("""
|
| 2911 |
<script>
|
|
|
|
| 2983 |
</script>
|
| 2984 |
|
| 2985 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2987 |
|
| 2988 |
""")
|
| 2989 |
gr.Markdown("### Screening")
|