【发布时间】:2022-09-27 19:25:31
【问题描述】:
我想将 JSON 对象传递给 FastAPI 后端。这是我在前端应用程序中所做的:
data = {\'labels\': labels, \'sequences\': sequences}
response = requests.post(api_url, data = data)
下面是 FastAPI 中后端 API 的样子:
@app.post(\"/api/zero-shot/\")
async def Zero_Shot_Classification(request: Request):
data = await request.json()
但是,我收到此错误:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
标签: python rest fastapi streamlit