MeUtils 2025.1.3.16.13.27__py3-none-any.whl → 2025.1.4.11.4.46__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-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/METADATA +28 -28
- {MeUtils-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/RECORD +10 -9
- meutils/apis/jimeng/common.py +72 -0
- meutils/apis/jimeng/files.py +86 -10
- meutils/apis/jimeng/lip_sync.py +11 -0
- meutils/data/VERSION +1 -1
- {MeUtils-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/LICENSE +0 -0
- {MeUtils-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/WHEEL +0 -0
- {MeUtils-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/entry_points.txt +0 -0
- {MeUtils-2025.1.3.16.13.27.dist-info → MeUtils-2025.1.4.11.4.46.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: MeUtils
|
3
|
-
Version: 2025.1.
|
3
|
+
Version: 2025.1.4.11.4.46
|
4
4
|
Summary: description
|
5
5
|
Home-page: https://github.com/yuanjie-ai/MeUtils
|
6
6
|
Author: yuanjie
|
@@ -63,42 +63,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
|
|
63
63
|
Requires-Dist: openai ; extra == 'ai'
|
64
64
|
Requires-Dist: langchain ; extra == 'ai'
|
65
65
|
Provides-Extra: all
|
66
|
-
Requires-Dist:
|
66
|
+
Requires-Dist: thriftpy2 ; extra == 'all'
|
67
|
+
Requires-Dist: pymongo ; extra == 'all'
|
68
|
+
Requires-Dist: dataframe-image ; extra == 'all'
|
69
|
+
Requires-Dist: schedule ; extra == 'all'
|
70
|
+
Requires-Dist: seaborn ; extra == 'all'
|
71
|
+
Requires-Dist: thefuck ; extra == 'all'
|
72
|
+
Requires-Dist: missingno ; extra == 'all'
|
73
|
+
Requires-Dist: uvicorn ; extra == 'all'
|
74
|
+
Requires-Dist: pandas-summary ; extra == 'all'
|
75
|
+
Requires-Dist: polars ; extra == 'all'
|
76
|
+
Requires-Dist: cachetools ; extra == 'all'
|
67
77
|
Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
|
68
|
-
Requires-Dist: filetype ; extra == 'all'
|
69
78
|
Requires-Dist: gunicorn ; extra == 'all'
|
70
|
-
Requires-Dist:
|
71
|
-
Requires-Dist:
|
79
|
+
Requires-Dist: reportlab ; extra == 'all'
|
80
|
+
Requires-Dist: iteration-utilities ; extra == 'all'
|
81
|
+
Requires-Dist: pymupd ; extra == 'all'
|
72
82
|
Requires-Dist: sqlalchemy ; extra == 'all'
|
73
|
-
Requires-Dist:
|
83
|
+
Requires-Dist: filetype ; extra == 'all'
|
84
|
+
Requires-Dist: sse-starlette ; extra == 'all'
|
85
|
+
Requires-Dist: faiss-cpu ; extra == 'all'
|
86
|
+
Requires-Dist: jmespath ; extra == 'all'
|
87
|
+
Requires-Dist: fastapi[all] ; extra == 'all'
|
88
|
+
Requires-Dist: pymilvus ; extra == 'all'
|
74
89
|
Requires-Dist: langchain ; extra == 'all'
|
75
|
-
Requires-Dist:
|
90
|
+
Requires-Dist: jinja2 ; extra == 'all'
|
91
|
+
Requires-Dist: simplejson ; extra == 'all'
|
92
|
+
Requires-Dist: redis-py-cluster ; extra == 'all'
|
76
93
|
Requires-Dist: geopy ; extra == 'all'
|
77
|
-
Requires-Dist: pyarrow ; extra == 'all'
|
78
|
-
Requires-Dist: faiss-cpu ; extra == 'all'
|
79
94
|
Requires-Dist: jieba ; extra == 'all'
|
80
95
|
Requires-Dist: openai ; extra == 'all'
|
81
|
-
Requires-Dist: thefuck ; extra == 'all'
|
82
|
-
Requires-Dist: asyncmy ; extra == 'all'
|
83
|
-
Requires-Dist: schedule ; extra == 'all'
|
84
|
-
Requires-Dist: seaborn ; extra == 'all'
|
85
|
-
Requires-Dist: pymilvus ; extra == 'all'
|
86
|
-
Requires-Dist: thriftpy2 ; extra == 'all'
|
87
|
-
Requires-Dist: sse-starlette ; extra == 'all'
|
88
|
-
Requires-Dist: dataframe-image ; extra == 'all'
|
89
|
-
Requires-Dist: jinja2 ; extra == 'all'
|
90
|
-
Requires-Dist: fastapi[all] ; extra == 'all'
|
91
|
-
Requires-Dist: pymupd ; extra == 'all'
|
92
|
-
Requires-Dist: cachetools ; extra == 'all'
|
93
|
-
Requires-Dist: iteration-utilities ; extra == 'all'
|
94
96
|
Requires-Dist: fastapi ; extra == 'all'
|
95
|
-
Requires-Dist: polars ; extra == 'all'
|
96
|
-
Requires-Dist: pandas-summary ; extra == 'all'
|
97
|
-
Requires-Dist: pymongo ; extra == 'all'
|
98
|
-
Requires-Dist: simplejson ; extra == 'all'
|
99
|
-
Requires-Dist: reportlab ; extra == 'all'
|
100
97
|
Requires-Dist: streamlit ; extra == 'all'
|
101
|
-
Requires-Dist:
|
98
|
+
Requires-Dist: asyncmy ; extra == 'all'
|
99
|
+
Requires-Dist: pymysql ; extra == 'all'
|
100
|
+
Requires-Dist: pretty-errors ; extra == 'all'
|
101
|
+
Requires-Dist: pyarrow ; extra == 'all'
|
102
102
|
Provides-Extra: ann
|
103
103
|
Requires-Dist: pymilvus ; extra == 'ann'
|
104
104
|
Requires-Dist: faiss-cpu ; extra == 'ann'
|
@@ -367,11 +367,12 @@ meutils/apis/jiema/24mail.py,sha256=GUszRtoDe3T9q-X4embwT5YhcjgQ3XnkTJMKX93sCF4,
|
|
367
367
|
meutils/apis/jiema/__init__.py,sha256=YBybggoDRYCNYcwJOypxR7MzfTjIhqO7BkGlTt7NDo4,271
|
368
368
|
meutils/apis/jiema/yezi.py,sha256=26vhnA3lC5049Rqx-CHO-wyGKbdZAfvjEOG90W38cr0,3675
|
369
369
|
meutils/apis/jimeng/__init__.py,sha256=a8CE_cOl9jqal0hycwaLm4Mnga8jmZlz9nCze_9bBqA,272
|
370
|
-
meutils/apis/jimeng/common.py,sha256=
|
370
|
+
meutils/apis/jimeng/common.py,sha256=5pH-qJsas8ocnwXWuHnBa0Pbniv6a6Q3uRyt53kjjno,11363
|
371
371
|
meutils/apis/jimeng/doubao.py,sha256=vSEaTQHQdyhpHwCoq6CIikDZkUC9ncyTgKxGUC8cMCI,4345
|
372
372
|
meutils/apis/jimeng/doubao_utils.py,sha256=XCHnvwfCOtJmPQuzDOCfKDMP_Pcqh-Y4w2h5f7Y2gzM,5999
|
373
|
-
meutils/apis/jimeng/files.py,sha256=
|
373
|
+
meutils/apis/jimeng/files.py,sha256=CBJ8W9pFy7D_GpV7buX3J9LMoqBYxl-EvrxkIYSu9s8,7523
|
374
374
|
meutils/apis/jimeng/images.py,sha256=Z1w8Jxqvom-rBB9MSfQz4QvfPLTEoamwyb9X9_yUmBk,4641
|
375
|
+
meutils/apis/jimeng/lip_sync.py,sha256=rynQPNngltS73GmuWbpMIuuAr0srZP5kUh0FMY6Ynas,267
|
375
376
|
meutils/apis/kling/__init__.py,sha256=pKz40SEjui1dhHBD-icyNTJOYhzLvxLxJCwszuH4vio,271
|
376
377
|
meutils/apis/kling/api.py,sha256=AuVQ9URmrbTlz7dEv_kIyhA9fMTZPL9rF3Td6KxTIMA,2183
|
377
378
|
meutils/apis/kling/images.py,sha256=FcCkvA4x1Po3SuugfQa8klT0Lrj7fq4N8kbzx6luUxI,5095
|
@@ -496,7 +497,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
|
|
496
497
|
meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
|
497
498
|
meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
|
498
499
|
meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
|
499
|
-
meutils/data/VERSION,sha256=
|
500
|
+
meutils/data/VERSION,sha256=yixHXXad2U23Mi4yr94vRu7SIQ6IWDMIx49zz1ZwIyQ,19
|
500
501
|
meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
501
502
|
meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
502
503
|
meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
|
@@ -843,9 +844,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
|
|
843
844
|
meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
|
844
845
|
meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
|
845
846
|
meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
|
846
|
-
MeUtils-2025.1.
|
847
|
-
MeUtils-2025.1.
|
848
|
-
MeUtils-2025.1.
|
849
|
-
MeUtils-2025.1.
|
850
|
-
MeUtils-2025.1.
|
851
|
-
MeUtils-2025.1.
|
847
|
+
MeUtils-2025.1.4.11.4.46.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
848
|
+
MeUtils-2025.1.4.11.4.46.dist-info/METADATA,sha256=YJIJUQ4-qTTCH1p3ePuwd3TngoVBN2WE-cOhCap8B5w,6200
|
849
|
+
MeUtils-2025.1.4.11.4.46.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
850
|
+
MeUtils-2025.1.4.11.4.46.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
|
851
|
+
MeUtils-2025.1.4.11.4.46.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
|
852
|
+
MeUtils-2025.1.4.11.4.46.dist-info/RECORD,,
|
meutils/apis/jimeng/common.py
CHANGED
@@ -12,6 +12,8 @@ from openai import AsyncClient
|
|
12
12
|
from meutils.pipe import *
|
13
13
|
from meutils.hash_utils import md5
|
14
14
|
from meutils.schemas.image_types import ImageRequest
|
15
|
+
from meutils.schemas.openai_types import TTSRequest
|
16
|
+
|
15
17
|
from meutils.schemas.jimeng_types import BASE_URL, MODELS_MAP
|
16
18
|
from meutils.str_utils.regular_expression import parse_url
|
17
19
|
from meutils.apis.jimeng.files import upload
|
@@ -241,6 +243,76 @@ async def create_draft_content(request: ImageRequest, token: str):
|
|
241
243
|
return draft_content
|
242
244
|
|
243
245
|
|
246
|
+
def create_photo_lip_sync(request: TTSRequest):
|
247
|
+
# 映射
|
248
|
+
tts_info = {
|
249
|
+
"name": request.voice or "魅力姐姐",
|
250
|
+
"text": request.input, # "永远相信美好的事情即将发生"
|
251
|
+
"speed": request.seed or 1,
|
252
|
+
"source_type": "text-to-speech",
|
253
|
+
"tone_category_id": 0,
|
254
|
+
"tone_category_key": "all",
|
255
|
+
"tone_id": "7382879492752019995",
|
256
|
+
"toneKey": request.voice or "魅力姐姐",
|
257
|
+
}
|
258
|
+
payload = {
|
259
|
+
"promptSource": "photo_lip_sync",
|
260
|
+
"generateTimes": 1,
|
261
|
+
"lipSyncInfo": tts_info,
|
262
|
+
"isUseAiGenPrompt": False,
|
263
|
+
"batchNumber": 1
|
264
|
+
}
|
265
|
+
|
266
|
+
return {
|
267
|
+
"submit_id": "",
|
268
|
+
"task_extra": json.dumps(payload),
|
269
|
+
"http_common_info": {
|
270
|
+
"aid": 513695
|
271
|
+
},
|
272
|
+
"input": {
|
273
|
+
"seed": 1834980836,
|
274
|
+
"video_gen_inputs": [
|
275
|
+
{
|
276
|
+
"v2v_opt": {},
|
277
|
+
"i2v_opt": {
|
278
|
+
"realman_avatar": {
|
279
|
+
"enable": true,
|
280
|
+
"origin_image": {
|
281
|
+
"width": 480,
|
282
|
+
"height": 270,
|
283
|
+
"image_uri": "tos-cn-i-tb4s082cfz/fae8f746367b40f5a708bf0f1e84de11",
|
284
|
+
"image_url": "" ########## https://oss.ffire.cc/files/kling_watermark.png
|
285
|
+
},
|
286
|
+
"resource_id_loopy": "34464cac-5e3e-46be-88ff-ccbc7da4d742",
|
287
|
+
"resource_id_std": "2f66b408-37c3-4de5-b8a4-ba15c104612e",
|
288
|
+
"origin_audio": {
|
289
|
+
"duration": 3.216,
|
290
|
+
"vid": "v02bc3g10000ctrpqrfog65purfpn7a0"
|
291
|
+
},
|
292
|
+
"tts_info": json.dumps(tts_info)
|
293
|
+
}
|
294
|
+
},
|
295
|
+
"audio_vid": "v02bc3g10000ctrpqrfog65purfpn7a0",
|
296
|
+
"video_mode": 4
|
297
|
+
}
|
298
|
+
]
|
299
|
+
},
|
300
|
+
"mode": "workbench",
|
301
|
+
"history_option": {},
|
302
|
+
"commerce_info": {
|
303
|
+
"resource_id": "generate_video",
|
304
|
+
"resource_id_type": "str",
|
305
|
+
"resource_sub_type": "aigc",
|
306
|
+
"benefit_type": "lip_sync_avatar_std"
|
307
|
+
},
|
308
|
+
"scene": "lip_sync_image",
|
309
|
+
"client_trace_data": {},
|
310
|
+
"submit_id_list": [
|
311
|
+
"d4554e2c-707f-4ebe-b4e6-93aa6687d1c1"
|
312
|
+
]
|
313
|
+
}
|
314
|
+
|
315
|
+
|
244
316
|
if __name__ == '__main__':
|
245
317
|
token = "693701c43e477b7c405cc7e2fef0ddbd"
|
246
318
|
token = "eb4d120829cfd3ee957943f63d6152ed"
|
meutils/apis/jimeng/files.py
CHANGED
@@ -42,7 +42,7 @@ def u(params):
|
|
42
42
|
|
43
43
|
|
44
44
|
class JJRequest:
|
45
|
-
def __init__(self, e, t, api, method="GET", params=None, data=None):
|
45
|
+
def __init__(self, e, t, api, method="GET", params=None, data=None, serviceName="imagex"):
|
46
46
|
self.t = t
|
47
47
|
self.e = e
|
48
48
|
self.api = api
|
@@ -50,14 +50,18 @@ class JJRequest:
|
|
50
50
|
self.params = params
|
51
51
|
self.data = data
|
52
52
|
|
53
|
+
self.serviceName = serviceName
|
54
|
+
|
53
55
|
def getAuthorization(self):
|
54
|
-
return f"AWS4-HMAC-SHA256 Credential={self.e['access_key_id']}/{self.t[0:8]}/cn-north-1/
|
56
|
+
return f"AWS4-HMAC-SHA256 Credential={self.e['access_key_id']}/{self.t[0:8]}/cn-north-1/{self.serviceName}/aws4_request, SignedHeaders=x-amz-date;x-amz-security-token, Signature={self.signature()}"
|
55
57
|
|
56
58
|
def signature(self):
|
57
59
|
r = self.getSigningKey()
|
58
60
|
return hmac_hash256(r, self.stringToSign()).hexdigest()
|
59
61
|
|
60
|
-
def getSigningKey(self, r="cn-north-1"
|
62
|
+
def getSigningKey(self, r="cn-north-1"):
|
63
|
+
n = self.serviceName
|
64
|
+
|
61
65
|
o = hmac_hash256("AWS4" + self.e['secret_access_key'], str(self.t[0:8]))
|
62
66
|
i = hmac_hash256(o, str(r))
|
63
67
|
s = hmac_hash256(i, str(n))
|
@@ -71,8 +75,8 @@ class JJRequest:
|
|
71
75
|
t.append(hash256(self.canonicalString()))
|
72
76
|
return "\n".join(t)
|
73
77
|
|
74
|
-
def credentialString(self, region="cn-north-1"
|
75
|
-
return "/".join([self.t[0:8], region, serviceName, "aws4_request"])
|
78
|
+
def credentialString(self, region="cn-north-1"):
|
79
|
+
return "/".join([self.t[0:8], region, self.serviceName, "aws4_request"])
|
76
80
|
|
77
81
|
def canonicalString(self):
|
78
82
|
e = []
|
@@ -169,6 +173,77 @@ def upload(image: bytes, upload_token: dict): # oss 跨账号不知道是否可
|
|
169
173
|
return oss_uri
|
170
174
|
|
171
175
|
|
176
|
+
@cache(ttl=15 * 60)
|
177
|
+
def upload_for_vod(image: bytes, upload_token: dict): # oss 跨账号不知道是否可以使用
|
178
|
+
# e = auth = upload_token['data']['auth'] # 豆包
|
179
|
+
data = upload_token['data']
|
180
|
+
service_id = data.get('service_id', '3jr8j4ixpe') # 即梦 3jr8j4ixpe 豆包 a9rns2rl98
|
181
|
+
|
182
|
+
if 'auth' in data:
|
183
|
+
data = data['auth']
|
184
|
+
|
185
|
+
session_token = data['session_token']
|
186
|
+
|
187
|
+
t = time.strftime("%Y%m%dT%H%M%SZ", time.gmtime())
|
188
|
+
|
189
|
+
params = {
|
190
|
+
"Action": "ApplyUploadInner",
|
191
|
+
"Version": "2020-11-19",
|
192
|
+
# "ServiceId": service_id,
|
193
|
+
"SpaceName": "artist_op",
|
194
|
+
|
195
|
+
"s": random_str(10),
|
196
|
+
|
197
|
+
"FileType": "video",
|
198
|
+
"FileSize": len(image),
|
199
|
+
|
200
|
+
}
|
201
|
+
|
202
|
+
r = JJRequest(data, t, "https://vod.bytedanceapi.com/", method="GET", params=params, serviceName="vod")
|
203
|
+
headers = {
|
204
|
+
'authorization': r.getAuthorization(),
|
205
|
+
'x-amz-date': t,
|
206
|
+
'x-amz-security-token': session_token,
|
207
|
+
}
|
208
|
+
# logger.debug(headers)
|
209
|
+
response = requests.get(r.api, params=params, headers=headers)
|
210
|
+
response.raise_for_status()
|
211
|
+
logger.debug(response.status_code)
|
212
|
+
response = response.json()
|
213
|
+
|
214
|
+
logger.debug(bjson(response))
|
215
|
+
if "Result" not in response:
|
216
|
+
return
|
217
|
+
|
218
|
+
upload_node = response['Result']['InnerUploadAddress']['UploadNodes'][0]
|
219
|
+
store_info = upload_node['StoreInfos'][0]
|
220
|
+
logger.debug(bjson(store_info))
|
221
|
+
|
222
|
+
vid = upload_node['Vid']
|
223
|
+
upload_host = upload_node['UploadHost']
|
224
|
+
|
225
|
+
oss_uri = store_info['StoreUri']
|
226
|
+
oss_token = store_info['Auth']
|
227
|
+
|
228
|
+
headers = {
|
229
|
+
"authorization": oss_token,
|
230
|
+
"content-length": str(len(image)),
|
231
|
+
"content-Type": "image/jpeg",
|
232
|
+
"content-crc32": fileCRC32(image),
|
233
|
+
}
|
234
|
+
|
235
|
+
# upload_url = f"https://tos-hl-x.snssdk.com/upload/v1/{oss_uri}"
|
236
|
+
upload_url = f"https://{upload_host}/upload/v1/{oss_uri}"
|
237
|
+
|
238
|
+
response = requests.post(upload_url, headers=headers, data=image)
|
239
|
+
response.raise_for_status()
|
240
|
+
response = response.json()
|
241
|
+
|
242
|
+
logger.debug(response)
|
243
|
+
|
244
|
+
return oss_uri
|
245
|
+
|
246
|
+
|
172
247
|
if __name__ == "__main__":
|
173
248
|
from meutils.apis.jimeng.common import get_upload_token
|
174
249
|
|
@@ -176,12 +251,13 @@ if __name__ == "__main__":
|
|
176
251
|
token = "de2215a7bb8e442774cf388f03fac84c"
|
177
252
|
|
178
253
|
# jimeng
|
179
|
-
token = "
|
254
|
+
token = "eb4d120829cfd3ee957943f63d6152ed"
|
180
255
|
#
|
181
256
|
upload_token = arun(get_upload_token(token))
|
182
257
|
|
183
258
|
#
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
259
|
+
with open("11.jpg", "rb") as f:
|
260
|
+
file = image = f.read()
|
261
|
+
|
262
|
+
# upload(image, upload_token)
|
263
|
+
print(upload_for_vod(image, upload_token))
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2025.01.
|
1
|
+
2025.01.04.11.04.46
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|