Spaces:
Paused
Paused
auth
Browse files
app.py
CHANGED
|
@@ -175,24 +175,25 @@ with gr.Blocks() as interface:
|
|
| 175 |
# Login button to simulate the login process
|
| 176 |
login_button = gr.Button("Login")
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
|
|
|
| 197 |
|
| 198 |
interface.launch()
|
|
|
|
| 175 |
# Login button to simulate the login process
|
| 176 |
login_button = gr.Button("Login")
|
| 177 |
|
| 178 |
+
if login_button:
|
| 179 |
+
# Components for chat (initially hidden)
|
| 180 |
+
input_box = gr.Textbox(label="Enter your question", placeholder="Type your question here...", visible=False)
|
| 181 |
+
submit_btn = gr.Button("Submit", visible=False)
|
| 182 |
+
chat_history = gr.Chatbot(label="Chat History", visible=False)
|
| 183 |
+
|
| 184 |
+
# Handle login button click
|
| 185 |
+
login_button.click(
|
| 186 |
+
login_user,
|
| 187 |
+
inputs=[],
|
| 188 |
+
outputs=[login_button], # You can also update the UI to show login status
|
| 189 |
+
queue=False
|
| 190 |
+
).then(
|
| 191 |
+
lambda token: check_login(is_logged_in(token)),
|
| 192 |
+
inputs=[],
|
| 193 |
+
outputs=[input_box, submit_btn]
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
# Input submission and chat handling
|
| 197 |
+
submit_btn.click(chat, inputs=[input_box, chat_history], outputs=[chat_history, input_box])
|
| 198 |
|
| 199 |
interface.launch()
|