<filename>test_train_post.py
import requests

url = 'http://localhost:8080'

# regular data post
files = { 'file': open('data/titanic.csv', 'rb') }
r = requests.post(url + '/train/create', files=files, data={})
print(r.content)

nextr = { 'file': open('data/titanic_extra.csv', 'rb') }
r2 = requests.post(url + '/train/insert', files=nextr, data={})
print(r2.content)

body = [
    {"Age": 85, "Sex": "male", "Embarked": "S"}
]
r3 = requests.post(url + '/predict', json=body)
print(r3.content)

# text data post
files = { 'file': open('data/nlp.csv', 'rb') }
r = requests.post(url + '/train_text/create', files=files, data={})
print(r.content)

files = { 'file': open('data/nlp2.csv', 'rb') }
r2 = requests.post(url + '/train_text/insert', files=files, data={})
print(r2.content)

body = [
    {"text": "what now?"}
]
r3 = requests.post(url + '/predict', json=body)
print(r3.content)

<filename>test_train_post.py
import requests

url = 'http://localhost:8080'

# regular data post
files = { 'file': open('data/titanic.csv', 'rb') }
r = requests.post(url + '/train/create', files=files, data={})
print(r.content)

nextr = { 'file': open('data/titanic_extra.csv', 'rb') }
r2 = requests.post(url + '/train/insert', files=nextr, data={})
print(r2.content)

body = [
    {"Age": 85, "Sex": "male", "Embarked": "S"}
]
r3 = requests.post(url + '/predict', json=body)
print(r3.content)

# text data post
files = { 'file': open('data/nlp.csv', 'rb') }
r = requests.post(url + '/train_text/create', files=files, data={})
print(r.content)

files = { 'file': open('data/nlp2.csv', 'rb') }
r2 = requests.post(url + '/train_text/insert', files=files, data={})
print(r2.content)

body = [
    {"text": "what now?"}
]
r3 = requests.post(url + '/predict', json=body)
print(r3.content)

# regular data post # text data post