https://flyte.org logo
a

Akarsh Upadhyay

07/04/2022, 2:30 PM
Issue: I have been following the docs here, but while running the code
unionml serve app:app --reload --model-path /tmp/model_object.pt
, I get this error on the browser
{"detail": "Method Not Allowed"}
and in the terminal, it is showing:
INFO: 127.0.0.1:64825 - "GET /predict HTTP/1.1" 405 Method Not Allowed
My Folder structure looks like this (i.e in same directory): -> app.py -> client.py -> main.py (same code as app.py) Thanks,
s

Samhita Alla

07/05/2022, 4:20 AM
Have you tried sending a POST request to the URL?
Copy code
import requests
from sklearn.datasets import load_digits

digits = load_digits(as_frame=True)
features = digits.frame[digits.feature_names]


prediction_response = <http://requests.post|requests.post>(
    "<http://127.0.0.1:8000/predict>",
    json={"features": features.sample(5, random_state=42).to_dict(orient="records")},
)

print(prediction_response.text)
cc: @Niels Bantilan
a

Akarsh Upadhyay

07/05/2022, 7:51 AM
Got it, firstly I ran the command:
unionml serve app:app --reload --model-path /tmp/model_object.pt
, and then running the client.py file, I got the output. Thanks for your help!!
n

Niels Bantilan

07/05/2022, 2:10 PM
hey @Akarsh Upadhyay so the online server is simply a FastAPI App. You can do to
127.0.0.1:<port>/docs
on your browser to see the API documentation
76 Views