Spaces:
Sleeping
Sleeping
File size: 489 Bytes
a8ac691 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#%%
import requests
import json
#%%
# url = "http://127.0.0.1:5000/" # for flask
url = "http://127.0.0.1:5000/" # for docker if exposed to 9000
data = ["good", "bad"]
j_data = json.dumps(data)
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
r = requests.post(url, data=j_data, headers=headers)
print(r, r.text)
# %%
# r
# %%
# sent_score = json.loads(r.text)
# sent_score
# %%
# label = sent_score[0]["label"]
# score = sent_score[0]["score"]
# label, score
# %%
|