I am having a very simple FastAPI service, when I try to hit the /spell_checking
endpoint, I get this error `AttributeError: 'dict' object has no attribute 'encode'.
I am hitting the endpoint using postman, with Post request, and this is the url: http://127.0.0.1:8080/spell_checking
, the payload is JSON with value:
{"word": "testign"}
Here is my code:
from fastapi import FastAPI, Response, Request
import uvicorn
from typing import Dict
app = FastAPI()
@app.post('/spell_checking')
def spell_check(word: Dict ) :
data = {
'corrected': 'some value'
}
return Response(data)
@app.get('/')
def welcome():
return Response('Hello World')
if __name__ == '__main__':
uvicorn.run(app, port=8080, host='0.0.0.0')
I still dont know why a simple service like this would show this error!