Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,8 +127,9 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 127 |
gr.Markdown("## P-MSQ Authorization")
|
| 128 |
gr.Markdown("P-MSQ is in closed alpha test! The model, api and more are subject to change. Even though the space is public, P-MSQ is restricted for public use, available for testers.")
|
| 129 |
api_user_input = gr.Textbox(placeholder="snowflake", label="UserID")
|
| 130 |
-
api_key_input = gr.Textbox(placeholder="Enter your API key", label="Token")
|
| 131 |
auth_button = gr.Button("Authorize")
|
|
|
|
| 132 |
|
| 133 |
with gr.Column(visible=False) as chat_view:
|
| 134 |
gr.Markdown("## P-MSQ Chat Interface")
|
|
@@ -188,7 +189,8 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 188 |
if authorize(user, api_key):
|
| 189 |
return gr.update(visible=False), gr.update(visible=True)
|
| 190 |
else:
|
| 191 |
-
return gr.update(visible=True), gr.update(visible=False)
|
|
|
|
| 192 |
|
| 193 |
auth_button.click(authorize_and_proceed, inputs=[api_user_input, api_key_input], outputs=[auth_view, chat_view])
|
| 194 |
|
|
|
|
| 127 |
gr.Markdown("## P-MSQ Authorization")
|
| 128 |
gr.Markdown("P-MSQ is in closed alpha test! The model, api and more are subject to change. Even though the space is public, P-MSQ is restricted for public use, available for testers.")
|
| 129 |
api_user_input = gr.Textbox(placeholder="snowflake", label="UserID")
|
| 130 |
+
api_key_input = gr.Textbox(placeholder="Enter your API key", label="Token", type='password')
|
| 131 |
auth_button = gr.Button("Authorize")
|
| 132 |
+
auth_status = gr.Textbox(label="Authorization Status", interactive=False)
|
| 133 |
|
| 134 |
with gr.Column(visible=False) as chat_view:
|
| 135 |
gr.Markdown("## P-MSQ Chat Interface")
|
|
|
|
| 189 |
if authorize(user, api_key):
|
| 190 |
return gr.update(visible=False), gr.update(visible=True)
|
| 191 |
else:
|
| 192 |
+
return gr.update(visible=True), gr.update(visible=False), auth_status.update(value="Invalid userid/token")
|
| 193 |
+
|
| 194 |
|
| 195 |
auth_button.click(authorize_and_proceed, inputs=[api_user_input, api_key_input], outputs=[auth_view, chat_view])
|
| 196 |
|