Spaces:
Sleeping
Sleeping
Commit
·
a2863d4
1
Parent(s):
c757957
added basic authentication
Browse files- .gitignore +1 -0
- test.py +9 -1
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.env
|
test.py
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
|
|
| 1 |
import requests
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
root_url = "https://pgurazada1-dataframe-agent-docker.hf.space/"
|
| 4 |
predict_url = root_url + "/v1/input"
|
| 5 |
|
| 6 |
sample_input = "How many customers do we have?"
|
| 7 |
|
| 8 |
-
response = requests.post(
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
response.status_code
|
| 11 |
|
|
|
|
| 1 |
+
import os
|
| 2 |
import requests
|
| 3 |
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
root_url = "https://pgurazada1-dataframe-agent-docker.hf.space/"
|
| 9 |
predict_url = root_url + "/v1/input"
|
| 10 |
|
| 11 |
sample_input = "How many customers do we have?"
|
| 12 |
|
| 13 |
+
response = requests.post(
|
| 14 |
+
predict_url, data=sample_input,
|
| 15 |
+
auth=('demouser', os.environ['PASSWD'])
|
| 16 |
+
)
|
| 17 |
|
| 18 |
response.status_code
|
| 19 |
|