T O P
kingscolor

Agree with the other comments. I shouldn't enable this, but I do believe I spot your problem. you wrote: `u/app.post("/predict/")` `async def root(comment:UserInput):` `text = [UserInput.comment]` `results = makePrediction.predict(text)` `return {"prediction": str(results)}` `u/app.get("/")` `async def root():` `return {"message": "BERT Boi is up!"}` what you should have (fixing formatting errors as well): @app.post("/predict/") async def root(user_input: UserInput): # modified name text = [user_input.comment] # this is the error results = makePrediction.predict(text) return {"prediction": str(results)} @app.get("/") async def root(): return {"message": "BERT Boi is up!"} The error is because you tried to access an attribute (```.comment```) of an uninitialized object (```UserInput```). This could be solved (incorrectly) by initializing it: ```UserInput().comment```. However, you want the object that was passed through FastAPI. To make it clearer, I renamed your query parameter to ```user_input```. FastAPI will store any query data in this variable, so you'll use this variable in the rest of function. Hence, ```user_input.comment```.


Dry_Back_1116

>nput > >). This could be solved (incorrectly) by initializing it: > >UserInput().comment > >. However, you want the object that was passed through FastAPI. To make it clearer, I renamed your query parameter to > >user\_input > >. FastAPI will store any query data in this variable, so you'll use this variable in the rest of function. Hence, > >user\_input.comment > >. Thank you, I figured it out! :)


nekokattt

**turn on logging** and show the logs and traceback, as already asked


nikhil_shady

what’s the error? such an amateur post. post the traceback and the code that’s giving the error.