MeUtils 2024.11.29.18.21.1__py3-none-any.whl → 2024.11.29.19.50.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/METADATA +27 -27
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/RECORD +12 -11
- meutils/async_task/celery_config.py +4 -1
- meutils/async_task/tasks/replicateai.py +24 -0
- meutils/async_task/utils.py +30 -2
- meutils/data/VERSION +1 -1
- meutils/schemas/db/oneapi_types.py +4 -1
- meutils/schemas/task_types.py +7 -3
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/LICENSE +0 -0
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/WHEEL +0 -0
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/entry_points.txt +0 -0
- {MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: MeUtils
|
3
|
-
Version: 2024.11.29.
|
3
|
+
Version: 2024.11.29.19.50.1
|
4
4
|
Summary: description
|
5
5
|
Home-page: https://github.com/yuanjie-ai/MeUtils
|
6
6
|
Author: yuanjie
|
@@ -61,42 +61,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
|
|
61
61
|
Requires-Dist: openai ; extra == 'ai'
|
62
62
|
Requires-Dist: langchain ; extra == 'ai'
|
63
63
|
Provides-Extra: all
|
64
|
+
Requires-Dist: thefuck ; extra == 'all'
|
64
65
|
Requires-Dist: thriftpy2 ; extra == 'all'
|
65
|
-
Requires-Dist:
|
66
|
-
Requires-Dist:
|
67
|
-
Requires-Dist:
|
66
|
+
Requires-Dist: streamlit ; extra == 'all'
|
67
|
+
Requires-Dist: missingno ; extra == 'all'
|
68
|
+
Requires-Dist: dataframe-image ; extra == 'all'
|
68
69
|
Requires-Dist: pymongo ; extra == 'all'
|
70
|
+
Requires-Dist: reportlab ; extra == 'all'
|
71
|
+
Requires-Dist: jieba ; extra == 'all'
|
69
72
|
Requires-Dist: openai ; extra == 'all'
|
70
|
-
Requires-Dist:
|
71
|
-
Requires-Dist:
|
73
|
+
Requires-Dist: pyarrow ; extra == 'all'
|
74
|
+
Requires-Dist: pymupd ; extra == 'all'
|
72
75
|
Requires-Dist: sse-starlette ; extra == 'all'
|
73
|
-
Requires-Dist: filetype ; extra == 'all'
|
74
|
-
Requires-Dist: cachetools ; extra == 'all'
|
75
|
-
Requires-Dist: gunicorn ; extra == 'all'
|
76
|
-
Requires-Dist: fastapi ; extra == 'all'
|
77
|
-
Requires-Dist: pymilvus ; extra == 'all'
|
78
|
-
Requires-Dist: iteration-utilities ; extra == 'all'
|
79
|
-
Requires-Dist: geopy ; extra == 'all'
|
80
|
-
Requires-Dist: pymysql ; extra == 'all'
|
81
|
-
Requires-Dist: missingno ; extra == 'all'
|
82
|
-
Requires-Dist: jieba ; extra == 'all'
|
83
76
|
Requires-Dist: schedule ; extra == 'all'
|
77
|
+
Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
|
84
78
|
Requires-Dist: asyncmy ; extra == 'all'
|
85
|
-
Requires-Dist:
|
86
|
-
Requires-Dist:
|
79
|
+
Requires-Dist: simplejson ; extra == 'all'
|
80
|
+
Requires-Dist: pymilvus ; extra == 'all'
|
81
|
+
Requires-Dist: seaborn ; extra == 'all'
|
87
82
|
Requires-Dist: pretty-errors ; extra == 'all'
|
88
|
-
Requires-Dist:
|
89
|
-
Requires-Dist:
|
83
|
+
Requires-Dist: geopy ; extra == 'all'
|
84
|
+
Requires-Dist: gunicorn ; extra == 'all'
|
85
|
+
Requires-Dist: faiss-cpu ; extra == 'all'
|
86
|
+
Requires-Dist: uvicorn ; extra == 'all'
|
87
|
+
Requires-Dist: langchain ; extra == 'all'
|
90
88
|
Requires-Dist: sqlalchemy ; extra == 'all'
|
89
|
+
Requires-Dist: iteration-utilities ; extra == 'all'
|
90
|
+
Requires-Dist: jmespath ; extra == 'all'
|
91
|
+
Requires-Dist: fastapi ; extra == 'all'
|
92
|
+
Requires-Dist: fastapi[all] ; extra == 'all'
|
91
93
|
Requires-Dist: pandas-summary ; extra == 'all'
|
92
|
-
Requires-Dist:
|
94
|
+
Requires-Dist: cachetools ; extra == 'all'
|
95
|
+
Requires-Dist: redis-py-cluster ; extra == 'all'
|
96
|
+
Requires-Dist: pymysql ; extra == 'all'
|
93
97
|
Requires-Dist: jinja2 ; extra == 'all'
|
94
|
-
Requires-Dist:
|
95
|
-
Requires-Dist:
|
96
|
-
Requires-Dist: dataframe-image ; extra == 'all'
|
97
|
-
Requires-Dist: pyarrow ; extra == 'all'
|
98
|
-
Requires-Dist: uvicorn ; extra == 'all'
|
99
|
-
Requires-Dist: streamlit ; extra == 'all'
|
98
|
+
Requires-Dist: polars ; extra == 'all'
|
99
|
+
Requires-Dist: filetype ; extra == 'all'
|
100
100
|
Provides-Extra: ann
|
101
101
|
Requires-Dist: pymilvus ; extra == 'ann'
|
102
102
|
Requires-Dist: faiss-cpu ; extra == 'ann'
|
@@ -416,14 +416,15 @@ meutils/apis/voice_clone/__init__.py,sha256=y7Rpn90LocHhA0ywrDP_fT4QAK7sr4JsIX5w
|
|
416
416
|
meutils/apis/voice_clone/fish.py,sha256=6m8zcS2KEqmalKy2ArnOaNovyxsQp_sw4d_O1kVZR2s,7146
|
417
417
|
meutils/apis/voice_clone/fish_api.py,sha256=pDpE-B8HFiGIOV3NVd1HmFrCC2GQc3wH-81oNbTS0mY,307
|
418
418
|
meutils/async_task/__init__.py,sha256=45cUr-GWvQ1JFYGOYPOIkHLyTR3JbfP_PEYrmktpMLo,367
|
419
|
-
meutils/async_task/celery_config.py,sha256
|
419
|
+
meutils/async_task/celery_config.py,sha256=-p8-uGQq0HFFifZWZY6duCxEDcPJpWA4A_Rnz-WNysU,3430
|
420
420
|
meutils/async_task/common.py,sha256=ZJ4e0CsEJf1ppPmGSwPCwhZBAkUL5xsi_t1ny-bJuko,845
|
421
421
|
meutils/async_task/demo_create_tasks.py,sha256=DBUxi8lp4iJZrubn6XztRHB4DuZDEXpohSxCH6NMKuc,2219
|
422
|
-
meutils/async_task/utils.py,sha256=
|
422
|
+
meutils/async_task/utils.py,sha256=FRyQAsMw4mWxOm9TseorJ4gBMd3RjNS3SSxDv4f2jPA,3613
|
423
423
|
meutils/async_task/通用设计.py,sha256=kGdrJHJu9VoOkyGHREn0KUtBTibAaLIcG0O6hEJNhLA,3232
|
424
424
|
meutils/async_task/tasks/__init__.py,sha256=flHRXJMdts_9az9T9V1c5l3Y-gaDD88COWrARr4WAKU,246
|
425
425
|
meutils/async_task/tasks/_all.py,sha256=Vz63k9yvgj-IBGjekm0u2t571TTT0nMRMqcPvPqJAbY,533
|
426
426
|
meutils/async_task/tasks/kling.py,sha256=DwOUHyNDBpM1olCpow_cVct8iPpg2PEqY180wpTt07o,904
|
427
|
+
meutils/async_task/tasks/replicateai.py,sha256=wbxx6kB7GQZPnKRE6J6r1mEv3wO8X7XaGaNMC5rBVoE,716
|
427
428
|
meutils/async_task/tasks/test.py,sha256=f-QY-k81ixe4x-rRO7yqStZ1w8MdVoq-ooq9bDzXOeI,2148
|
428
429
|
meutils/async_task/tasks/vidu.py,sha256=obBG4_bf1oPIlLxeca1s1dGOnlyam2xYRy-8TrH3ZTk,620
|
429
430
|
meutils/async_utils/__init__.py,sha256=IiJLRm258jkM4xAjUKOD7tVwHIemj7_1CuzXCu3TuQU,284
|
@@ -459,7 +460,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
|
|
459
460
|
meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
|
460
461
|
meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
|
461
462
|
meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
|
462
|
-
meutils/data/VERSION,sha256=
|
463
|
+
meutils/data/VERSION,sha256=mR6Qrl-yDOywYfTLDBOiRw8Fq1J7X3zGSiB5mleXchM,19
|
463
464
|
meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
464
465
|
meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
465
466
|
meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
|
@@ -654,7 +655,7 @@ meutils/schemas/runwayml_types.py,sha256=q6g00kg1PYCDjpw-notgbcUGwRAlIa8kAmU52Zu
|
|
654
655
|
meutils/schemas/siliconflow_types.py,sha256=amOygjMqbSss4021sCNX1p5d-k1wa2tNLr0gnke1Vrc,8429
|
655
656
|
meutils/schemas/step_types.py,sha256=nGTPXZ7RwOF2RTsPBQguLLcIaBxHs4bsZkYa_LalcJ0,648
|
656
657
|
meutils/schemas/suno_types.py,sha256=KTdcwaJNDUFiY8izVJSZdGZgEMb0OhdiRR_dJVN-Cz0,14967
|
657
|
-
meutils/schemas/task_types.py,sha256=
|
658
|
+
meutils/schemas/task_types.py,sha256=bPcW6r-X0P28SkYwF8E6OoieFoMMVLQBb6s-ca5Dp0k,4380
|
658
659
|
meutils/schemas/translator_types.py,sha256=xufNQeyim7RhkzAK_J5_JchZfqaUBDXFwMtrPUu1xzI,627
|
659
660
|
meutils/schemas/tripo3d_types.py,sha256=mQF65HwHYmczRgAIuXK5hGxWDWNYDq-Xu9pja7Dwy4o,1452
|
660
661
|
meutils/schemas/tryblend_types.py,sha256=glZ0diRJvZmfQotcCWYBA832inihy8TvVWxWZ64CzWA,27793
|
@@ -663,7 +664,7 @@ meutils/schemas/vidu_types.py,sha256=Wa947mT5pL9yR4utM-A9oQvNvgaJorr9YRccryHnHH4
|
|
663
664
|
meutils/schemas/wechat_types.py,sha256=XtIJpMNBzkqBcU68Qno8bnUfHzDOXwFNCIL-6VYQKOA,9260
|
664
665
|
meutils/schemas/yuanbao_types.py,sha256=ZmB-7_eAuTU3QDonNgy0vcVP4YQNwA5yJ8G4mvfOmUE,11966
|
665
666
|
meutils/schemas/db/__init__.py,sha256=m1maURVoM6dIW0yt6ELZrZTzULtkHybVOSXtHNJRVIU,272
|
666
|
-
meutils/schemas/db/oneapi_types.py,sha256=
|
667
|
+
meutils/schemas/db/oneapi_types.py,sha256=hQiWXiF9jcXELosrYkLaai5ZjmbhUSrKfm07OlJgegM,2860
|
667
668
|
meutils/schemas/oneapi/__init__.py,sha256=uevbi3QAvFzN9WPbx9bYKTDyKt7P2ueZO6W0nSiD0sk,289
|
668
669
|
meutils/schemas/oneapi/_types.py,sha256=ClvAaNy3SahEN8lL8KEErHTD6HANelXUeKc_3iLfosQ,1488
|
669
670
|
meutils/schemas/oneapi/common.py,sha256=DPo8jsY0ytKFTILKi3-Apz6VK6cM_lBJ1xKqDNRjT88,22573
|
@@ -792,9 +793,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
|
|
792
793
|
meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
|
793
794
|
meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
|
794
795
|
meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
|
795
|
-
MeUtils-2024.11.29.
|
796
|
-
MeUtils-2024.11.29.
|
797
|
-
MeUtils-2024.11.29.
|
798
|
-
MeUtils-2024.11.29.
|
799
|
-
MeUtils-2024.11.29.
|
800
|
-
MeUtils-2024.11.29.
|
796
|
+
MeUtils-2024.11.29.19.50.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
797
|
+
MeUtils-2024.11.29.19.50.1.dist-info/METADATA,sha256=KSzeOgv_j546q543J1Dm00DXFdeDnIYRS9HeFKDFbuo,6143
|
798
|
+
MeUtils-2024.11.29.19.50.1.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
799
|
+
MeUtils-2024.11.29.19.50.1.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
|
800
|
+
MeUtils-2024.11.29.19.50.1.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
|
801
|
+
MeUtils-2024.11.29.19.50.1.dist-info/RECORD,,
|
@@ -14,7 +14,10 @@ from kombu import Exchange, Queue
|
|
14
14
|
|
15
15
|
# 基础配置
|
16
16
|
broker_url = 'redis://localhost:6379/0' # 消息代理(推荐使用Redis)
|
17
|
-
|
17
|
+
broker_url = os.getenv('REDIS_URL', broker_url)
|
18
|
+
|
19
|
+
# result_backend = f"redis://localhost:6379/1" # 结果存储
|
20
|
+
result_backend = f"{broker_url.replace('/0', '/')}/1" # 结果存储
|
18
21
|
|
19
22
|
# 添加以下配置增加可靠性
|
20
23
|
broker_connection_retry = True
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : replicateai
|
5
|
+
# @Time : 2024/11/29 19:08
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
|
11
|
+
|
12
|
+
from meutils.pipe import *
|
13
|
+
from meutils.async_utils import async_to_sync_pro
|
14
|
+
from meutils.decorators.retry import retrying
|
15
|
+
from meutils.async_task import worker, shared_task
|
16
|
+
|
17
|
+
from meutils.apis.replicateai import raw as replicate
|
18
|
+
|
19
|
+
|
20
|
+
@shared_task(pydantic=True, retry_kwargs={'max_retries': 5, 'countdown': 10})
|
21
|
+
@async_to_sync_pro
|
22
|
+
async def create_task(request: replicate.ReplicateRequest, **kwargs):
|
23
|
+
response = await replicate.create_task(request)
|
24
|
+
return response
|
meutils/async_task/utils.py
CHANGED
@@ -31,13 +31,29 @@ async def get_task(
|
|
31
31
|
remote_get_task: Optional[Callable] = None,
|
32
32
|
filter_kwargs: Optional[dict] = None
|
33
33
|
):
|
34
|
+
"""
|
35
|
+
|
36
|
+
:param task_id:
|
37
|
+
:param remote_get_task:
|
38
|
+
:param filter_kwargs: #######参数可以舍弃
|
39
|
+
filter_kwargs = {
|
40
|
+
"task_id": task_id, #########理论上只需这个
|
41
|
+
"user_id": user_id,
|
42
|
+
"platform": "replicate",
|
43
|
+
"action": "replicate", # 模型
|
44
|
+
}
|
45
|
+
:return:
|
46
|
+
"""
|
34
47
|
result = AsyncResult(id=task_id)
|
35
48
|
|
36
49
|
if result.ready():
|
37
50
|
if result.successful():
|
38
|
-
data = result.get() #
|
51
|
+
data = result.get() # TaskResponse
|
39
52
|
token = data.pop("system_fingerprint", None) # 远程任务 token/apikey
|
40
53
|
|
54
|
+
# data.get('platform')
|
55
|
+
# data.get('action')
|
56
|
+
|
41
57
|
response = TaskResponse(
|
42
58
|
task_id=task_id,
|
43
59
|
|
@@ -47,7 +63,7 @@ async def get_task(
|
|
47
63
|
)
|
48
64
|
|
49
65
|
if remote_get_task: # 获取远程任务
|
50
|
-
response: TaskResponse = await remote_get_task(task_id, token) # todo:
|
66
|
+
response: TaskResponse = await remote_get_task(task_id, token) # todo: 缓存一份,todo: user_id、platform/action
|
51
67
|
|
52
68
|
if not isinstance(data, dict):
|
53
69
|
data = data.model_dump()
|
@@ -78,6 +94,18 @@ async def get_task(
|
|
78
94
|
|
79
95
|
# todo: 可以设计更通用的
|
80
96
|
async def update_oneapi_from_response(task: OneapiTask, task_response: TaskResponse):
|
97
|
+
"""
|
98
|
+
|
99
|
+
filter_kwargs = {
|
100
|
+
"task_id": task_id,
|
101
|
+
"user_id": user_id,
|
102
|
+
"platform": "replicate",
|
103
|
+
"action": "replicate", # 模型
|
104
|
+
}
|
105
|
+
|
106
|
+
需要获取这几个信息 user_id
|
107
|
+
|
108
|
+
"""
|
81
109
|
if task.status in {"SUCCESS", "FAILURE"}: return False # 跳出轮询,不再更新
|
82
110
|
|
83
111
|
task.data = task_response.model_dump(exclude_none=True, exclude={"system_fingerprint"})
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2024.11.29.
|
1
|
+
2024.11.29.19.50.01
|
@@ -33,6 +33,9 @@ class Hero(SQLModel, table=True):
|
|
33
33
|
|
34
34
|
class OneapiTask(SQLModel, table=True):
|
35
35
|
"""https://github.com/Calcium-Ion/new-api/blob/main/model/task.go"""
|
36
|
+
|
37
|
+
__tablename__ = "tasks" # 自定义表名
|
38
|
+
|
36
39
|
id: Optional[int] = Field(default=None, primary_key=True)
|
37
40
|
|
38
41
|
task_id: Optional[str] = Field(default=None, max_length=50)
|
@@ -78,4 +81,4 @@ if __name__ == '__main__':
|
|
78
81
|
print(Hero())
|
79
82
|
# print(Tasks())
|
80
83
|
|
81
|
-
print(
|
84
|
+
print(OneapiTask.__name__)
|
meutils/schemas/task_types.py
CHANGED
@@ -177,8 +177,12 @@ if __name__ == '__main__':
|
|
177
177
|
# , ** {"a": 1, "system_fingerprint": 1}
|
178
178
|
response = TaskResponse(system_fingerprint="121")
|
179
179
|
|
180
|
-
print(response.model_dump())
|
180
|
+
# print(response.model_dump())
|
181
|
+
#
|
182
|
+
# response.__dict__.update({"a": 1, "system_fingerprint": 1})
|
183
|
+
#
|
184
|
+
# print(response.model_dump())
|
181
185
|
|
182
|
-
response.
|
186
|
+
response.user_id = 1
|
183
187
|
|
184
|
-
print(response
|
188
|
+
print(response)
|
File without changes
|
File without changes
|
{MeUtils-2024.11.29.18.21.1.dist-info → MeUtils-2024.11.29.19.50.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|