Simple Model Deploy Restful Api!
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size restful_api-0.0.4-py3-none-any.whl (4.7 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size restful_api-0.0.4.tar.gz (2.9 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for restful_api-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00675dd6ffb6708694ec35bd0c7098379e0d43218973c2f0d67bfe724f9527ee |
|
MD5 | 7a47de7bccad91c9df90d814fcfd0171 |
|
BLAKE2-256 | 360a2039b07db068f1557b5917068ca4de83baff5ce7ddb5ccfe1521b678d45c |