1、fastapi

python flask tornado fastapi sanic web框架测试:https://blog.csdn.net/dxcai/article/details/106402558

参考:https://github.com/tiangolo/fastapi

pip install fastapi
pip install uvicorn

fastapi1.py文件

from typing import Optional

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: Optional[str] = None):
    return {"item_id": item_id, "q": q}

运行

##fastapi1为上面代码文件名称
uvicorn fastapi1:app --reload

在这里插入图片描述

还可以看接口:
在这里插入图片描述

2、streamlit、gradio

参考:
https://github.com/streamlit/streamlit/
https://streamlit.io/

类似软件:
https://github.com/gradio-app/gradio

# 安装
pip install streamlit

代码 streamlit1.py

import streamlit as st
x = st.slider('x')
st.write(x, 'squared is', x * x)

命令行运行;然后可以8501端口看

streamlit run streamlit1.py

在这里插入图片描述

在这里插入图片描述

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐