Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
定义 Pydantic(嵌套)模型
如果我使用 GET 给定一个 id 我会得到一个 JSON 如下所示 data id 81 ks k1 25 k2 5 items id 1 name John surname Smith id 2 name Jane
python
json
FastAPI
pydantic
Python FastAPI:返回的 gif 图像没有动画
下面是我的 Python FastAPI 路由和 HTML 页面 Python app get status code 200 async def upload file file UploadFile File error img Ima
javascript
python
html
FastAPI
FastAPI 以串行方式而不是并行方式运行 api 调用
我有以下代码 import time from fastapi import FastAPI Request app FastAPI app get ping async def ping request Request print Hel
python
Asynchronous
pythonasyncio
FastAPI
concurrentprocessing
启动时加载 FastAPI 项目中的模型
所以我目前正在开发一个为多种 NLP 服务提供服务的 FastAPI 项目 为此 我想提供来自 spacy 和 Huggingface 的不同模型 自从那些模型相当大的推理时间为每个发布请求加载模型相当长 我的想法是在 FastAPI 启动
deployment
FastAPI
uvicorn 的 unix 套接字上的 Nginx 反向代理无法正常工作
Files main py from fastapi import FastAPI app FastAPI app get def read root return Hello World nginx conf events worker
python
Nginx
reverseproxy
FastAPI
uvicorn
如何使用 FastAPI 防止表单输入时页面重新加载
我有一个使用 FastAPI 的简单程序 它将浮点值乘以 2 并将其显示在 HTML 中 该值通过 HTML 表单输入 我想知道如何获得动态显示的值 而无需在按 Enter 或按提交按钮时重新加载页面 以下是脚本 main py 和 dou
python
html
FastAPI
如何在 FastAPI 中进行多处理
在提供 FastAPI 请求时 我需要对列表中的每个元素执行一项 CPU 密集型任务 我想在多个 CPU 核心上进行此处理 在 FastAPI 中执行此操作的正确方法是什么 我可以使用标准吗multiprocessing模块 到目前为止我发
python
multiprocessing
pythonasyncio
FastAPI
uvicorn
Python3.8 - FastAPI 和无服务器 (AWS Lambda) - 无法处理发送到 api 端点的文件
我已经通过 AWS Lambda 函数将 FastAPI 与无服务器结合使用几个月了 效果非常好 我正在创建一个新的 api 端点 它需要发送一个文件 在我的本地计算机上使用时它工作得很好 但是当我部署到 AWS Lambda 时 当我尝试
python
amazonwebservices
awslambda
Serverless
FastAPI
如何使用域获取 FastAPI 中的当前路径?
我有一个用 FastAPI 编写的简单路线 如下所示 from fastapi import FastAPI app FastAPI app get foo bar rand int foo bar async def main rand
python
FastAPI
如何使用 FastAPI 返回 HTMLResponse
是否可以在端点显示 HTML 文件 例如用户正在访问的主页 是的 FastAPI 可能有HTMLResponse 您可以返回一个HTMLResponse from fastapi import FastAPI from fastapi re
python
Web
FastAPI
如何使用ML模型和FastAPI处理多个用户的请求?
我正在研究通过FastAPI分发人工智能模块的过程 我创建了一个 FastAPI 应用程序 它使用预先学习的机器学习模型来回答问题 在这种情况下 一个用户使用是没有问题的 但是当多个用户同时使用时 响应可能会太慢 那么 当多个用户输入问题时
python
machinelearning
multiprocessing
FastAPI
FastAPI 中的返回值[重复]
这个问题在这里已经有答案了 我试图在 FastAPI 中返回 matplotlib figure Figure 如果我像图像一样保存它 它就可以工作 代码在这里 router get graph id file name Return th
python
matplotlib
Web
FastAPI
FastAPI 中的单元测试
我有一个使用 FastAPI 开发的后端应用程序 使用 SQLModel SQLAlchemy 和 Pydantic 并连接到 Postgres 数据库 我有集成测试来测试我的端点是否可以与暂存 PG DB 正常工作 但现在我必须编写单元测
Pytest
FastAPI
sqlmodel
如何在前端使用 JavaScript Fetch API 从 FastAPI 后端下载文件?
这是我的 FastAPI python 代码 它返回一个 ics file app get latLong async def read item lat float long float mainFunc lat long return
javascript
python
html
fetchapi
FastAPI
如何将后端和前端放在一起 - 从 fastapi 后端端点返回 React 前端
首先 我只想说这是我的第一个 Web 应用程序项目 在过去的几天里 我一直在努力寻找如何将前端和后端放在一起的答案 我有很多问题 但我想回答的主要问题是如何从后端端点返回我的前端 最终产品 我的理解是这样的 如有错误请指正 前端代码由客户端
ReactJS
FastAPI
重定向到不同路由时,FastAPI RedirectResponse 获取 {"message": "Forbidden"}
请向我提出一个几乎不可能创建可重现示例的问题 我使用 Docker 无服务器和部署在 AWS API Gateway 上的 FastAPI 设置了 API 讨论的所有路由都受到传递到标头中的 api key 的保护 x api key 我正
Docker
awsapigateway
amazoncloudfront
FastAPI
Serverless
如果用户未使用 FastAPI-Login 包登录,则重定向到登录页面
我想在用户未登录时将他们重定向到登录页面 这是我的代码 from fastapi import Depends FastAPI HTTPException status Body Request from fastapi encoders
python
FastAPI
如何列出 FastAPI 中所有定义的 URL 路径?
假设我有一个包含 100 多个 API 端点的 FastAPI 项目 如何列出所有 API 路径 为了获取所有可能的 URL 模式 我们需要访问定义的 URL 路由这是正在运行的应用程序实例的一个属性 我们至少可以通过两种方式做到这一点 U
python
python3x
FastAPI
FastAPI 的 RedirectResponse 在 Swagger UI 中无法按预期工作
我有一个带下载端点的 FastAPI 应用程序 此下载端点的作用是使用BlobServiceClient 对于 Azure Blob 存储 生成请求中指定的文件的令牌和 Blob URL 我想要做的是将用户重定向到该 URL 这是下载点的代
python
redirect
swagger
FastAPI
SwaggerUI
FastAPI异步后台任务会阻塞其他请求吗?
我想在 FastAPI 中运行一个简单的后台任务 其中涉及一些计算 然后将其转储到数据库中 但是 计算会阻止它接收更多请求 from fastapi import BackgroundTasks FastAPI app FastAPI db
python
FastAPI
«
1
2
3
4
5
6
...10
»