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.2.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for restful_api-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35e799cca60029822603ab51b975e5655aad594ce65553497ef0ece1875bd200 |
|
MD5 | 721c8dc17a50b885a89869561908d4b2 |
|
BLAKE2b-256 | bf3cccfc9a7cce2ea8ae37adc9076f34673715fac40fb6c7e0fd8853f28dfbf6 |