FastAPI & Streamlit - Error 422

Hello everyone,
I have a problem with an experimental app I am creating, using FastAPI, Streamoit and Heroku.

What I am trying to do, is basicall callung an API that I have created, that has a machine learning model to do prediction.
The problem is that when I call it, I recive back the error code “422”.
I have tried to ask for help in stack overflow, but perhaps here you will have a solution.

Here the link to the question on stack, with full details:

Thank you in advance

Do you have the body message of the error?

Hello @franciscoed ,
The error is literally only : <Response [422]>

@marcolivierbertoz

You’re just printing the result (which is a requests.model.Response object), try this

print(result.text)

Tryed with print(result.text) but doesn’t show anything.

If I do simply: result.text, it show this message:

{“detail”:[{“loc”:[“body”,0],“msg”:“Expecting value: line 1 column 1 (char 0)”,“type”:“value_error.jsondecode”,“ctx”:{“msg”:“Expecting value”,“doc”:“Age=73.55&Anemia=1&CPK=4960&Diabetes=1&Ejection_fraction=56&HBP=1&Platelets=561913.09&Serum_Creatinine=5.43&Serum_Sodium=82&Woman_Man=0&Smoking=1&Time=178”,“pos”:0,“lineno”:1,“colno”:1}}]}

Which I think it gaves me back the data I sent to the API. Perhaps there is a code error in the API