Skip to main content

: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()

Release files for restful-api 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for restful-api 0.0.4
File Size Uploaded
restful_api-0.0.4.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for restful-api 0.0.4
File Interpreter ABI Platform
restful_api-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / restful_api-0.0.4.tar.gz

Download URL restful_api-0.0.4.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d737546edbfc6cfd785e83c5dfae7ad01fb786c8f5b260fd8dffc409d3d7812
BLAKE2b-256 checksum
How to use checksums
6ebfe8ae5bdc5076c265ee143c365963253e2bf8ff3530727f9e9cec2d2e7e06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release files / restful_api-0.0.4-py3-none-any.whl

Download URL restful_api-0.0.4-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00675dd6ffb6708694ec35bd0c7098379e0d43218973c2f0d67bfe724f9527ee
BLAKE2b-256 checksum
How to use checksums
360a2039b07db068f1557b5917068ca4de83baff5ce7ddb5ccfe1521b678d45c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page