description
Project description
:rocket: RestfulApi :facepunch:
模型部署
Install
pip install restful_api -U
Usage
import jieba
from restful_api import Api
pred1 = lambda **kwargs: kwargs['x'] + kwargs['y']
pred2 = lambda x=1, y=1: x + y
pred3 = lambda text='小米是家不错的公司': jieba.lcut(text)
# 多服务堆叠
api = Api('/post1', pred1)
api = Api('/post2', pred2, app=api.app)
api = Api('/post3', pred3, app=api.app)
api.app.run()
Test
import requests
json = {'x': 1, 'y': 10}
requests.post('http://127.0.0.1:5000/post1', json=json).json()
requests.post('http://127.0.0.1:5000/post2', json=json).json()
requests.post('http://127.0.0.1:5000/post3', json=json).json()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
restful_api-0.0.3.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for restful_api-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d10bf9c40e250c80b0374f2a9b0d071f686d838535c25960ea807b5d239e6232 |
|
MD5 | 208a2bcdcc268a5e2e2c33f368f6ed49 |
|
BLAKE2b-256 | 117f7c66026bfe41a9b1488a59f69096c7552c0b506f5e46cc06a4bdfacf215b |