trace.moe 的最小异步 API 包装器
项目描述
tracemoe-py
trace.moe的最小异步 API 包装器。
安装
需要 Python 3.6 或更高版本。
pip install tracemoe-py
用法
import asyncio
from tracemoe import TraceMoe
async def main():
async with TraceMoe() as tracemoe:
# Search by image URL
results: list = await tracemoe.search('https://XXX/XXX.jpg')
print(results)
# Search by image upload
results: list = await tracemoe.search(open('/home/ichbinleoon/XXX.jpg', 'rb'))
print(results)
# Get account info
info: dict = await tracemoe.me()
print(info)
asyncio.run(main())
高级用法
import asyncio
import aiohttp
from tracemoe import TraceMoe
async def main():
# Use an API key
tracemoe = TraceMoe(api_key='Your API key')
# Cut black borders
results: list = await tracemoe.search('https://XXX/XXX.jpg', cut_borders=True)
print(results)
# Filter by AniList ID
results: list = await tracemoe.search('https://XXX/XXX.jpg', anilist_id=11617)
print(results)
# Include AniList info
results: list = await tracemoe.search('https://XXX/XXX.jpg', anilist_info=True)
print(results)
await tracemoe.close()
# Use your own aiohttp session
session = aiohttp.ClientSession()
tracemoe = TraceMoe(session=session)
# ...
await tracemoe.close()
asyncio.run(main())
贡献
欢迎投稿!随意打开问题或提交拉取请求!
执照
麻省理工学院 © IchBinLeoon
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
tracemoe-py-1.0.3.tar.gz
(4.5 kB
查看哈希)
内置分布
tracemoe_py-1.0.3-py3-none-any.whl
(5.3 kB
查看哈希)
关
tracemoe_py -1.0.3-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 41491eb7a62449ac374b8daa4b939cf75cb1ff33a47f498543617c6548feeee7 |
|
| MD5 | 2b57b3d9b631c8dec82a8aac3b457865 |
|
| 布莱克2-256 | a7f14c5500eabe34f592bb48197e791bd540821247ba28af067c8f7b03810e99 |