Thread
#ecosystem-unionml
    Akarsh Upadhyay

    Akarsh Upadhyay

    2 months ago
    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,
    Samhita Alla

    Samhita Alla

    2 months ago
    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>(
        "<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
    Akarsh Upadhyay

    Akarsh Upadhyay

    2 months ago
    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

    Niels Bantilan

    2 months ago
    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