Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -130,7 +130,6 @@ def append_new_message(new_message):
|
|
| 130 |
"""
|
| 131 |
|
| 132 |
|
| 133 |
-
|
| 134 |
with gr.Blocks() as demo:
|
| 135 |
|
| 136 |
with gr.Column():
|
|
@@ -207,10 +206,10 @@ with gr.Blocks() as demo:
|
|
| 207 |
if authorize(user, api_key, PRIMARY_SYSTEM_INSTRUCTIONS):
|
| 208 |
gr.Info("Loading, please wait.")
|
| 209 |
messages_html, history = load_conversation(api_key)
|
| 210 |
-
return
|
| 211 |
else:
|
| 212 |
gr.Warning("Incorrect userid/token")
|
| 213 |
-
return
|
| 214 |
|
| 215 |
def save_custom_instructions(api_key, custom_instructions):
|
| 216 |
if api_key in sessions:
|
|
@@ -222,8 +221,12 @@ with gr.Blocks() as demo:
|
|
| 222 |
return "Session not found.", gr.update(value="")
|
| 223 |
|
| 224 |
|
| 225 |
-
auth_button.click(authorize_and_proceed,
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
|
| 229 |
if __name__ == "__main__":
|
|
|
|
| 130 |
"""
|
| 131 |
|
| 132 |
|
|
|
|
| 133 |
with gr.Blocks() as demo:
|
| 134 |
|
| 135 |
with gr.Column():
|
|
|
|
| 206 |
if authorize(user, api_key, PRIMARY_SYSTEM_INSTRUCTIONS):
|
| 207 |
gr.Info("Loading, please wait.")
|
| 208 |
messages_html, history = load_conversation(api_key)
|
| 209 |
+
return auth_status.update(visible=False), gr.update(visible=True), messages_html, history
|
| 210 |
else:
|
| 211 |
gr.Warning("Incorrect userid/token")
|
| 212 |
+
return auth_status.update(visible=True), gr.update(visible=False), auth_status.update(value="Invalid userid/token")
|
| 213 |
|
| 214 |
def save_custom_instructions(api_key, custom_instructions):
|
| 215 |
if api_key in sessions:
|
|
|
|
| 221 |
return "Session not found.", gr.update(value="")
|
| 222 |
|
| 223 |
|
| 224 |
+
auth_button.click(authorize_and_proceed,
|
| 225 |
+
inputs=[api_user_input, api_key_input],
|
| 226 |
+
outputs=[auth_status, chat_view, chatbot_output, history_state])
|
| 227 |
+
save_instructions_btn.click(save_custom_instructions,
|
| 228 |
+
inputs=[api_key_input, system_instructions_input],
|
| 229 |
+
outputs=auth_status)
|
| 230 |
|
| 231 |
|
| 232 |
if __name__ == "__main__":
|