fastapi开发
uvicorn生产
通过uvicorn.run()启动,其中test02为当前py文件,app为FastAPI的实例对象,这样启动默认为http://127.0.0.1:8000,当然也可以更改host和port
通过命令uvicorn test02:app --reload 其中--reload :可以自动重启
fastapi启动
fastapi dev main.py
https://www.cnblogs.com/u-damowang1/p/16016130.html
import uvicorn
import numpy as np
from fastapi import File, UploadFile, HTTPException, FastAPI
import cv2
import requests
import os
app = FastAPI()
@app.get('/')
async def root():
return {"msg": "Hello World"}
if __name__ == '__main__':
uvicorn.run('image_text_analysis:app', host='localhost', port=8000, reload=True)