Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,10 +64,8 @@ def gemini_response(prompt):
|
|
| 64 |
|
| 65 |
def chat_fn(message, chat_history):
|
| 66 |
chat_history = chat_history or []
|
| 67 |
-
# Хэрэглэгчийн мессеж нэмэх
|
| 68 |
chat_history.append({"role": "user", "content": message})
|
| 69 |
-
time.sleep(0.5)
|
| 70 |
-
# Gemini reply нэмэх
|
| 71 |
reply = gemini_response(message)
|
| 72 |
chat_history.append({"role": "assistant", "content": reply})
|
| 73 |
return chat_history, chat_history
|
|
@@ -95,7 +93,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as app:
|
|
| 95 |
# Tabs: Login / Signup
|
| 96 |
with gr.Tabs() as tabs:
|
| 97 |
|
| 98 |
-
with gr.Tab("Login")
|
| 99 |
log_user = gr.Textbox(label="Username")
|
| 100 |
log_pw = gr.Textbox(label="Password", type="password")
|
| 101 |
log_status = gr.Textbox(label="Status", interactive=False)
|
|
@@ -133,7 +131,6 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as app:
|
|
| 133 |
def login_action(username, password):
|
| 134 |
res = login(username, password)
|
| 135 |
if res == "SUCCESS":
|
| 136 |
-
# Login/signup tab-г hide хийж, chat UI-г гаргах
|
| 137 |
return "✅ Амжилттай нэвтэрлээ!", gr.update(visible=False), gr.update(visible=True)
|
| 138 |
return res, gr.update(visible=True), gr.update(visible=False)
|
| 139 |
|
|
|
|
| 64 |
|
| 65 |
def chat_fn(message, chat_history):
|
| 66 |
chat_history = chat_history or []
|
|
|
|
| 67 |
chat_history.append({"role": "user", "content": message})
|
| 68 |
+
time.sleep(0.5)
|
|
|
|
| 69 |
reply = gemini_response(message)
|
| 70 |
chat_history.append({"role": "assistant", "content": reply})
|
| 71 |
return chat_history, chat_history
|
|
|
|
| 93 |
# Tabs: Login / Signup
|
| 94 |
with gr.Tabs() as tabs:
|
| 95 |
|
| 96 |
+
with gr.Tab("Login"):
|
| 97 |
log_user = gr.Textbox(label="Username")
|
| 98 |
log_pw = gr.Textbox(label="Password", type="password")
|
| 99 |
log_status = gr.Textbox(label="Status", interactive=False)
|
|
|
|
| 131 |
def login_action(username, password):
|
| 132 |
res = login(username, password)
|
| 133 |
if res == "SUCCESS":
|
|
|
|
| 134 |
return "✅ Амжилттай нэвтэрлээ!", gr.update(visible=False), gr.update(visible=True)
|
| 135 |
return res, gr.update(visible=True), gr.update(visible=False)
|
| 136 |
|