AI_HUB
AI utils for developer. such as notice、send massage when model training is over.Bind WeChat Official Account(AI_HUB) 插入在代码里的小工具,可以在模型训练结束时通过公众号及时发送微信消息给自己,提高科研效率。 inferServer: server your ai model as a API and match the tianchi eval 简单的操作把你训练好的模型变为服务API,并且支持天池大赛的流评测。
INSTALL
pip install ai-hub
SAMPLE
NOTICE
from ai_hub import notice
#到AGIHub微信公众号获取个人openid如(oM8pVuBWl8Rw_vFz7rZNgeO4T8H8),需替换为自己的openid
nc = notice("oM8pVuBWl8Rw_vFz7rZNgeO4T8H8")
#借助AGIHub公众号发送消息给自己
nc.sendmsg("hi,AI_HUB.I am su")
inferServer
'''
依赖:pip install ai-hub #(version>=0.1.7)
测试用例:
model为y=2*x
请求数据为json:{"img":3}
-----------
post请求:
curl localhost:8080/tccapi -X POST -d '{"img":3}'
返回结果 6
'''
from ai_hub import inferServer
import json
class myInfer(inferServer):
def __init__(self, model):
super().__init__(model)
print("init_myInfer")
#数据前处理
def pre_process(self, data):
print("my_pre_process")
#json process
json_data = json.loads(data.decode('utf-8'))
img = json_data.get("img")
print("processed data: ", img)
return img
#数据后处理
def post_process(self, data):
print("post_process")
processed_data = data
return processed_data
#模型预测:默认执行self.model(preprocess_data),一般不用重写
#如需自定义,可覆盖重写
#def pridect(self, data):
# ret = self.model(data)
# return ret
if __name__ == "__main__":
mymodel = lambda x: x * 2
my_infer = myInfer(mymodel)
my_infer.run(debuge=True) #默认为("127.0.0.1", 80),可自定义端口,如用于天池大赛请默认即可,指定debuge=True可获得更多报错信息
获取OPENID
1.扫描关注公众号AGIHub
2.发送“openid”给公众号 即可获得openid
Metadata
Release files for tianchi 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tianchi-0.0.1.tar.gz | 4.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tianchi-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 kB
Release files / tianchi-0.0.1.tar.gz
| Download URL | tianchi-0.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db65e097446afa88644603e953e541335e3754837664a22a32665e1252acf6ab
|
|
BLAKE2b-256 checksum How to use checksums |
2b6a432a71a5cd94a5dcde26e3a562370e87c8038cb7fc8189523e011a8c6d57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / tianchi-0.0.1-py3-none-any.whl
| Download URL | tianchi-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c73f30424f04c43a5780ad9e6160589b2d63a8b45f6175ce99a65e147aec9135
|
|
BLAKE2b-256 checksum How to use checksums |
df9785f418e4bb69360709a00bcb2ae04b790473e86f522437594815e82296b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for tianchi 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.