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: - "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,

Samhita Alla

07/05/2022, 4:20 AM
Have you tried sending a POST request to the URL?
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>(
    json={"features": features.sample(5, random_state=42).to_dict(orient="records")},

cc: @Niels Bantilan

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!!

Niels Bantilan

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