Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,14 +15,14 @@ ASSISTANT_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/reso
|
|
| 15 |
USER_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/usr.png"
|
| 16 |
|
| 17 |
def authorize(api_key):
|
| 18 |
-
test_data = {"
|
| 19 |
test_headers = {
|
| 20 |
-
"Authorization": f"{
|
| 21 |
"Content-Type": "application/json",
|
| 22 |
}
|
| 23 |
-
response = requests.post("https://", headers=test_headers, data=json.dumps(test_data))
|
| 24 |
if response.status_code == 200:
|
| 25 |
-
headers["Authorization"] = f"{
|
| 26 |
return True
|
| 27 |
else:
|
| 28 |
return False
|
|
@@ -98,7 +98,7 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 98 |
|
| 99 |
with gr.Column(visible=True) as auth_view:
|
| 100 |
gr.Markdown("## P-MSQ Authorization")
|
| 101 |
-
api_key_input = gr.Textbox(placeholder="Enter your API key", label="API Key")
|
| 102 |
auth_button = gr.Button("Authorize")
|
| 103 |
|
| 104 |
with gr.Column(visible=False) as chat_view:
|
|
@@ -108,7 +108,7 @@ with gr.Blocks(css=".chatbox {height: 400px; overflow-y: auto; border: 1px solid
|
|
| 108 |
|
| 109 |
msg_input = gr.Textbox(
|
| 110 |
show_label=False,
|
| 111 |
-
placeholder="Type your message and press Enter...",
|
| 112 |
lines=2,
|
| 113 |
elem_id="input-text"
|
| 114 |
)
|
|
|
|
| 15 |
USER_PIC_PATH = "https://huggingface.co/spaces/PLRMB/P-MSQ-API-PREVIEW/resolve/main/usr.png"
|
| 16 |
|
| 17 |
def authorize(api_key):
|
| 18 |
+
test_data = {"user": f"{api_key}"}
|
| 19 |
test_headers = {
|
| 20 |
+
"Authorization": f"{API_TOKEN}",
|
| 21 |
"Content-Type": "application/json",
|
| 22 |
}
|
| 23 |
+
response = requests.post("https://polrambora.com/api/v2/checkSDPA", headers=test_headers, data=json.dumps(test_data))
|
| 24 |
if response.status_code == 200:
|
| 25 |
+
headers["Authorization"] = f"{API_TOKEN}"
|
| 26 |
return True
|
| 27 |
else:
|
| 28 |
return False
|
|
|
|
| 98 |
|
| 99 |
with gr.Column(visible=True) as auth_view:
|
| 100 |
gr.Markdown("## P-MSQ Authorization")
|
| 101 |
+
api_key_input = gr.Textbox(placeholder="Enter your API key or enter your Discord UserID", label="API Key/User ID")
|
| 102 |
auth_button = gr.Button("Authorize")
|
| 103 |
|
| 104 |
with gr.Column(visible=False) as chat_view:
|
|
|
|
| 108 |
|
| 109 |
msg_input = gr.Textbox(
|
| 110 |
show_label=False,
|
| 111 |
+
placeholder="Type your message and press Shift+Enter...",
|
| 112 |
lines=2,
|
| 113 |
elem_id="input-text"
|
| 114 |
)
|