MeUtils 2024.12.13.10.12.35__py3-none-any.whl → 2024.12.13.15.17.40__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MeUtils
3
- Version: 2024.12.13.10.12.35
3
+ Version: 2024.12.13.15.17.40
4
4
  Summary: description
5
5
  Home-page: https://github.com/yuanjie-ai/MeUtils
6
6
  Author: yuanjie
@@ -37,6 +37,7 @@ Requires-Dist: toml
37
37
  Requires-Dist: pyyaml
38
38
  Requires-Dist: jsonpath
39
39
  Requires-Dist: json-repair
40
+ Requires-Dist: nacos-sdk-python
40
41
  Requires-Dist: wget
41
42
  Requires-Dist: httpx
42
43
  Requires-Dist: requests
@@ -63,41 +64,41 @@ Requires-Dist: openai ; extra == 'ai'
63
64
  Requires-Dist: langchain ; extra == 'ai'
64
65
  Provides-Extra: all
65
66
  Requires-Dist: simplejson ; extra == 'all'
66
- Requires-Dist: redis-py-cluster ; extra == 'all'
67
- Requires-Dist: pymongo ; extra == 'all'
68
- Requires-Dist: pymilvus ; extra == 'all'
69
67
  Requires-Dist: openai ; extra == 'all'
70
- Requires-Dist: sqlalchemy ; extra == 'all'
71
- Requires-Dist: pyarrow ; extra == 'all'
68
+ Requires-Dist: uvicorn ; extra == 'all'
69
+ Requires-Dist: reportlab ; extra == 'all'
72
70
  Requires-Dist: sse-starlette ; extra == 'all'
73
- Requires-Dist: polars ; extra == 'all'
74
- Requires-Dist: jmespath ; extra == 'all'
75
- Requires-Dist: faiss-cpu ; extra == 'all'
71
+ Requires-Dist: filetype ; extra == 'all'
72
+ Requires-Dist: dataframe-image ; extra == 'all'
73
+ Requires-Dist: pymongo ; extra == 'all'
74
+ Requires-Dist: pretty-errors ; extra == 'all'
76
75
  Requires-Dist: langchain ; extra == 'all'
77
- Requires-Dist: schedule ; extra == 'all'
78
- Requires-Dist: fastapi[all] ; extra == 'all'
79
- Requires-Dist: pymupd ; extra == 'all'
80
- Requires-Dist: reportlab ; extra == 'all'
81
- Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
76
+ Requires-Dist: pyarrow ; extra == 'all'
82
77
  Requires-Dist: thefuck ; extra == 'all'
83
- Requires-Dist: cachetools ; extra == 'all'
78
+ Requires-Dist: iteration-utilities ; extra == 'all'
84
79
  Requires-Dist: streamlit ; extra == 'all'
85
- Requires-Dist: fastapi ; extra == 'all'
86
- Requires-Dist: uvicorn ; extra == 'all'
80
+ Requires-Dist: geopy ; extra == 'all'
81
+ Requires-Dist: jieba ; extra == 'all'
82
+ Requires-Dist: pandas-summary ; extra == 'all'
83
+ Requires-Dist: redis-py-cluster ; extra == 'all'
87
84
  Requires-Dist: gunicorn ; extra == 'all'
88
- Requires-Dist: iteration-utilities ; extra == 'all'
85
+ Requires-Dist: cachetools ; extra == 'all'
86
+ Requires-Dist: jmespath ; extra == 'all'
87
+ Requires-Dist: pymysql ; extra == 'all'
88
+ Requires-Dist: polars ; extra == 'all'
89
+ Requires-Dist: fastapi[all] ; extra == 'all'
90
+ Requires-Dist: pymupd ; extra == 'all'
91
+ Requires-Dist: pymilvus ; extra == 'all'
92
+ Requires-Dist: sqlalchemy ; extra == 'all'
89
93
  Requires-Dist: seaborn ; extra == 'all'
94
+ Requires-Dist: faiss-cpu ; extra == 'all'
95
+ Requires-Dist: schedule ; extra == 'all'
90
96
  Requires-Dist: missingno ; extra == 'all'
91
97
  Requires-Dist: jinja2 ; extra == 'all'
92
- Requires-Dist: geopy ; extra == 'all'
98
+ Requires-Dist: fastapi ; extra == 'all'
93
99
  Requires-Dist: asyncmy ; extra == 'all'
94
- Requires-Dist: pretty-errors ; extra == 'all'
100
+ Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
95
101
  Requires-Dist: thriftpy2 ; extra == 'all'
96
- Requires-Dist: filetype ; extra == 'all'
97
- Requires-Dist: dataframe-image ; extra == 'all'
98
- Requires-Dist: pymysql ; extra == 'all'
99
- Requires-Dist: pandas-summary ; extra == 'all'
100
- Requires-Dist: jieba ; extra == 'all'
101
102
  Provides-Extra: ann
102
103
  Requires-Dist: pymilvus ; extra == 'ann'
103
104
  Requires-Dist: faiss-cpu ; extra == 'ann'
@@ -37,6 +37,7 @@ examples/redis队列.py,sha256=A1djOzk_k_iEN-o5h_i3xdVJSCGnuDcokO_ExlC3nMI,507
37
37
  examples/redis队列_add.py,sha256=-SKdAaBHfa4QvNjqI50ExBwvf7OktjETtvjC9Xjonr8,647
38
38
  examples/rich_demo.py,sha256=KA8Eo3nv3_9QFLAgVj76qLzTHvw6TQuTOgzcnVaLV_4,916
39
39
  examples/shcedule_demo.py,sha256=lnfMhixL5BofruBIg5kvx_JiT16wp4_JteQ1Q4flfdg,958
40
+ examples/size_map.py,sha256=AySrSRfoQvJ7zaNWD6Mjbft1BcRi3Ctql2UgCC10umo,1062
40
41
  examples/test.py,sha256=SNuY_zzLHa9MpHksvTopGuWx_wTryZ_2L2WouLCJJRc,1165
41
42
  examples/typer_demo.py,sha256=HcnqBZQoaxpZVDrq9gb0aMLDK4WHlbUcXca3v9w-aTs,639
42
43
  examples/wandb_demo.py,sha256=jqxYoe0XsiphEjEDsl71hGBAr3ubWEcNmLbgF23_n6g,959
@@ -168,6 +169,8 @@ examples/clis/easy.py,sha256=QMI30c4qypJ9y9IEcxtYhOxaJRvtK7pDCAj-LIC5lE0,677
168
169
  examples/clis/fire_demo.py,sha256=Hv5ZAvw0Tq_ut9sgkLQg4U9DPqzYFHK9O4NbiYjNY4A,1315
169
170
  examples/clis/mcli.py,sha256=zfdt9YqSfLoNSqnna0Fgnug2Pbiv-dByUii6qcFoBBY,372
170
171
  examples/clis/pp.py,sha256=em0TtPZZbYXQAGV_5M2ll4pmqdYdw1287AE3398k8ic,457
172
+ examples/comp_utils/__init__.py,sha256=Q4BW-gHnOUiSSpupHsprsOAPp4kuBLcH60sL1RfS3PQ,361
173
+ examples/comp_utils/reverse_metric.py,sha256=qwcGgiHhaupIJER4gO0HQhhO07FDLFv-vfFhg6K6Q4s,1705
171
174
  examples/cython_demo/__init__.py,sha256=fe5J1GzoGM50VMZka30tYyoAI2IyHvOBca23n2NAMew,243
172
175
  examples/cython_demo/demo.py,sha256=Sc_7UezRgTeVQUG49obsgzmj47m-k_ogthvWQaMzPdM,289
173
176
  examples/gr/__init__.py,sha256=gjQA240MutG1ODpP8BehAEVesWznheEo_mTUPFS3QEQ,270
@@ -342,7 +345,7 @@ meutils/apis/images/demo.py,sha256=Cjk-EKMKbp44czykW_44qR0TzElX8nNCALqXBBw5sJA,4
342
345
  meutils/apis/images/recraft.py,sha256=fqSXLuyhoy6u1uEwvGl0CISOHab_wVLWVdX3NFziamM,10140
343
346
  meutils/apis/images/fal/__init__.py,sha256=A7w3ZAS7Tv20N4X4Em6NshDxKSCPAzaPxHJTbM3BbyM,272
344
347
  meutils/apis/images/fal/files.py,sha256=hxcetu8Mcdp-UICh-CF7LuTLFShvGMwgKHxpHyFGj28,1318
345
- meutils/apis/images/fal/images.py,sha256=z7JhKMDT4tbPgkNEM2V27OVQLVfOYU1dhUnw-pHBcg8,1677
348
+ meutils/apis/images/fal/images.py,sha256=VdobSRcMuU32Q1dEdTJCy68oXTjomz-yzLLLVE2F7WM,1774
346
349
  meutils/apis/images/fal/images_.py,sha256=C-C1TTQtMJ6RRcd-4FeYPn0R5IpPRPUFmBbrTVs_ypA,1446
347
350
  meutils/apis/images/flux/__init__.py,sha256=W_PZabQm6EmtJYmzEiEpL_WCXTAW0AiJ-t_n5UTrE8c,271
348
351
  meutils/apis/images/flux/fluxpro.py,sha256=NFl9t9C3R3jsNJpez4o9tOz3r-fjRXj-vKMxCSTRDTU,4022
@@ -406,7 +409,7 @@ meutils/apis/siliconflow/images.py,sha256=hmzfSJohweytrL6aX7yy7sYamdlPQFwEF9Q3zH
406
409
  meutils/apis/siliconflow/rerankers.py,sha256=GuKT33MmAiVULqNaAO9IIy1Zp570-kYJ6xP03eLCp5Y,1259
407
410
  meutils/apis/siliconflow/text_to_image.py,sha256=rDxk6NIj4TjigcSPVDZknQR9nUpK5CTJBXc3KjI1Z8Y,4457
408
411
  meutils/apis/siliconflow/utils.py,sha256=Awe0V7Mkceop1vWWrw9901cKQ6HHntIn8HbIG0fEo40,2091
409
- meutils/apis/siliconflow/videos.py,sha256=8EbW-Ai4pvprnjlNRWYXu4msxp4U_sGXnHKof4KxLMc,1071
412
+ meutils/apis/siliconflow/videos.py,sha256=TutqBIeuYkmDtnGGXu6baHfeU6YagdXZGL2RPCHUvIw,2498
410
413
  meutils/apis/sunoai/__init__.py,sha256=O8J8jKTmvZGGovkF_jCRl3vbL68a4_dXVSxiKIYTkFo,244
411
414
  meutils/apis/sunoai/haimian.py,sha256=CSISElYbbGFnVCxCgAbHM_YZ9ELUjhuFQ6jdYM0hh7E,5521
412
415
  meutils/apis/sunoai/suno.py,sha256=I7UgqkBd7rd8BvOlZqzkf64n7Z2fjw678OnpP5DOKcM,17156
@@ -469,18 +472,15 @@ meutils/cmds/__init__.py,sha256=JTOGhMAhL-4tiFqtYZ_itEXKMsWab5q-MkfxnSRLs9M,293
469
472
  meutils/cmds/cmd.py,sha256=vfY6-I_0EClGU7z6061iWftkw4zMK8wICOPtiPuIfzo,458
470
473
  meutils/cmds/hdfs_cmd.py,sha256=E6a6ouXmZt-M2oz5Hy_ecvx6t08AmPGLtj1h9I3F_pM,1734
471
474
  meutils/cmds/subprocess_demo.py,sha256=oTeTIx8k6XwtOT6hZpmy9XNcRErzilqWcdoxcrVcHjs,629
472
- meutils/comp_utils/__init__.py,sha256=Q4BW-gHnOUiSSpupHsprsOAPp4kuBLcH60sL1RfS3PQ,361
473
- meutils/comp_utils/reverse_metric.py,sha256=qwcGgiHhaupIJER4gO0HQhhO07FDLFv-vfFhg6K6Q4s,1705
474
475
  meutils/config_utils/__init__.py,sha256=GhgsStfGJDC8F_YgC6X5Jnj9HkgXJXxeYiJWTAkWKTo,271
475
- meutils/config_utils/manager.py,sha256=YJnvr_74P30L-WEtNUR_66Xz4fcYdQbWhBNL394rv-A,3118
476
- meutils/config_utils/nacosx.py,sha256=5x6WlCvjExaA7R9moBxc3DV9l1oFTtNazC6pObaYjMg,1110
476
+ meutils/config_utils/manager.py,sha256=QL4zwUjSrLBfWLeTwoXXLAW4Fy9bi7ktA5gBtemR1gk,3172
477
477
  meutils/config_utils/lark_utils/__init__.py,sha256=Gf-5Y8uZiqY9jdbfiIboL92MQjOTOo0ZZ245PGxCbaY,297
478
478
  meutils/config_utils/lark_utils/common.py,sha256=WB1VKB3vdYyzqWosp5T-7uBIupNXl1L7SM3Lf5GRaOU,14274
479
479
  meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfHOno5NxNAio,293
480
480
  meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
481
481
  meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
482
482
  meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
483
- meutils/data/VERSION,sha256=fhWuRtngo-59fGT3-oYQu1uSsNKaIvhcp74WxD8I9XU,19
483
+ meutils/data/VERSION,sha256=I35SIobgb4T4StpJV1XRa6tSTWoYTmi1IDLHScTJh8Q,19
484
484
  meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
485
485
  meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
486
486
  meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
@@ -554,7 +554,7 @@ meutils/jwt_utils/__init__.py,sha256=hU1CYBK90Q9QKVrf1s6VFKZwWjHioHa6bO2AuDn7_eo
554
554
  meutils/jwt_utils/common.py,sha256=MBIKj4N8nMVAg_qQ9ki3U74Q7ZxFYsZDLi7xgTvWGsA,858
555
555
  meutils/llm/__init__.py,sha256=mYv0QpACLd-wz4htIduPuTU3mX06_Y8ZprxDohtZGBM,244
556
556
  meutils/llm/check_api.py,sha256=Vlan35FGvjPLP-dZu_Gfgmki-G89YPV96-x1oXji79I,3566
557
- meutils/llm/check_utils.py,sha256=0jRWX_gI_7d9rQMM7ToVEKiTC4tK18DHlD_CIwOSHkU,3374
557
+ meutils/llm/check_utils.py,sha256=wA7mHaWEqcN-GBeoqUw2ee_54G-Bht-m1opqZkAEFss,3354
558
558
  meutils/llm/demo.py,sha256=gyGjTxuNFMOa1X4CXaChkq0lcjbKiRsnSRhkeMvsoQk,3822
559
559
  meutils/llm/openai_client.py,sha256=S0ijrWxVt_ABDghhNL0Rg2EUUov8envSMStzxcpg4P4,364
560
560
  meutils/llm/utils.py,sha256=WzNaSuVcCWYukDa14cqgY6d2I5w5KILME11iE0oV2IE,2148
@@ -657,7 +657,7 @@ meutils/schemas/fish_types.py,sha256=yC0ZFr3Ebh8F0OhtMsXYaIfNNvzOM2LT9YtKTaRoHGU
657
657
  meutils/schemas/hailuo_types.py,sha256=hmkjFPID5HS26Ayk80xS2a38XcubokEHxzg86cC0Ki8,6150
658
658
  meutils/schemas/haimian_types.py,sha256=jGu484UviAeBgy5OIUyRY4uYCxXfv16zDPqiJQr9wNQ,1364
659
659
  meutils/schemas/idphoto_types.py,sha256=nuHbpppejRSkJCiQ7YKx0Gnke0ShKZhOvdg0e7tk9-0,1074
660
- meutils/schemas/image_types.py,sha256=mba128lFaIGhPcUJG5JZeDGxNYFRgkJrMuWPY8iG6LA,11569
660
+ meutils/schemas/image_types.py,sha256=kcYdL7f-UsixSltsnfytSHn6W4OtAmIMMGBdVmV20k8,11594
661
661
  meutils/schemas/jina_types.py,sha256=SLRRBCap2B1uXnHF7Sgnlz1Work8HvdIltjj4oVlGTk,8826
662
662
  meutils/schemas/kimi_types.py,sha256=PjCgHwCDNzKasn4X6rUzvOENqKYT3xj07cgp71IdsDA,3607
663
663
  meutils/schemas/kling_types.py,sha256=brWaREBtQeZGUuwgOW2p-vIm2WWInYkq8UfrLInT-Ik,6959
@@ -675,10 +675,10 @@ meutils/schemas/playwright_types.py,sha256=zhZd53m1Wg4zlGtq2JM4z7Aon-u_eF6rzs-_T
675
675
  meutils/schemas/prodia_types.py,sha256=knh_lzAxMfWMoqAPmvyMweay9PmQmsoQ1X6Mj17ohWg,476
676
676
  meutils/schemas/replicate_types.py,sha256=Todfo-y2Gq1MW8IyEmzz_ZlTxuQ3PvIfiF0KkrmJaYw,3160
677
677
  meutils/schemas/runwayml_types.py,sha256=q6g00kg1PYCDjpw-notgbcUGwRAlIa8kAmU52ZuXyLQ,6128
678
- meutils/schemas/siliconflow_types.py,sha256=pVdeteRQQ3p8u6Lb2VoQawrm3W4m4EM251txSlIpBLo,8595
678
+ meutils/schemas/siliconflow_types.py,sha256=a8SOf-bh5ZBddqsCqJNPFfw9olxk-bD_ySqTr8d0aZw,8597
679
679
  meutils/schemas/step_types.py,sha256=nGTPXZ7RwOF2RTsPBQguLLcIaBxHs4bsZkYa_LalcJ0,648
680
680
  meutils/schemas/suno_types.py,sha256=KTdcwaJNDUFiY8izVJSZdGZgEMb0OhdiRR_dJVN-Cz0,14967
681
- meutils/schemas/task_types.py,sha256=pMVRtvPUxb5bMQ9SKn2gzMRUAvTUMTmsPFryrsARgss,4561
681
+ meutils/schemas/task_types.py,sha256=Vnt6xDUOJTxcCuoaMHDMrZg0IdRHQIcEMfSYYMExEhw,4563
682
682
  meutils/schemas/translator_types.py,sha256=xufNQeyim7RhkzAK_J5_JchZfqaUBDXFwMtrPUu1xzI,627
683
683
  meutils/schemas/tripo3d_types.py,sha256=mQF65HwHYmczRgAIuXK5hGxWDWNYDq-Xu9pja7Dwy4o,1452
684
684
  meutils/schemas/tryblend_types.py,sha256=glZ0diRJvZmfQotcCWYBA832inihy8TvVWxWZ64CzWA,27793
@@ -708,15 +708,16 @@ meutils/serving/celery/router.py,sha256=6MTC7MsiaTFh9Qocus9MtP0fIU6uEDFgzV5v8uw7
708
708
  meutils/serving/celery/tasks.py,sha256=07QE9MYzaANDlg6crx6apuR6wfmNuryUKt76J8pEPIc,1526
709
709
  meutils/serving/celery/通用设计.py,sha256=kGdrJHJu9VoOkyGHREn0KUtBTibAaLIcG0O6hEJNhLA,3232
710
710
  meutils/serving/fastapi/__init__.py,sha256=_NvGfai2sMzsywCQk-hYRm-nTz0O6op2ln5kEUiqGqM,290
711
- meutils/serving/fastapi/common.py,sha256=xuVlnF_U4s9LQnwhUK3cbH5OcfEM0M6NqJ3gZm9enic,4681
711
+ meutils/serving/fastapi/common.py,sha256=yWanPonzfcrLunojZz4tNzRNTlygqK3B8o8VpZoubTs,3922
712
712
  meutils/serving/fastapi/gunicorn.conf.py,sha256=1ylGijXbW8bVQoJu9TUCvkurVUGk0ZGHL2GYKtm2DfY,7791
713
+ meutils/serving/fastapi/lifespans.py,sha256=Vpa8oIipOxW_7zhX3tE2O_G80PhUVz-eDsp7Ox85y-M,1590
713
714
  meutils/serving/fastapi/utils.py,sha256=H5lQSU7-IfJ2w9FWbaJ34LCbQSaNTFSU7z1pG5wZlRo,2965
714
715
  meutils/serving/fastapi/__demo/__init__.py,sha256=TxXjqy2ZxAkadPxqN92Xq3ixCUYkQ-4X6UxsReRpHhc,271
715
716
  meutils/serving/fastapi/__demo/异步任务.py,sha256=60_ruA4ljlTLIP5zxcejmm9WJ0SDuqpsO49SZK9vA_s,1444
716
717
  meutils/serving/fastapi/dependencies/__init__.py,sha256=shI1EgfH4gFuajmHGlzt_ArdDrFq8DqnUg7ycpFuYl0,245
717
- meutils/serving/fastapi/dependencies/auth.py,sha256=WDdFPRApBJrL8-APHAnQyMFrT7OnfeHg0oABwLVKm6Q,822
718
+ meutils/serving/fastapi/dependencies/auth.py,sha256=Q2EnVhoQo8sXnefVAdckKJ72R1SuZnMXIBvVK6ryu20,859
718
719
  meutils/serving/fastapi/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
719
- meutils/serving/fastapi/exceptions/http_error.py,sha256=6NW48Iadu-LyDBtp_P7YHWhBfwkz3OKTerz585FSGUk,2064
720
+ meutils/serving/fastapi/exceptions/http_error.py,sha256=JtwHe_1OfJ0fs3F-zVIDvvx4PRBYFYe7gjbbwBk2SWc,2255
720
721
  meutils/serving/fastapi/exceptions/validation_error.py,sha256=Q71wYfzGsVjLA-SQ3R5a8iT0kDG01mwriVUXHhvsTv0,1234
721
722
  meutils/serving/fastapi/routers/__init__.py,sha256=F473oGpbMmCFMbnfuk9MKyO30ke-YvP7AR5jhsnxjNg,270
722
723
  meutils/serving/fastapi/routers/_test.py,sha256=FgymiRBXz_EEerTc4V7aY9iTUZ1u0qZSTqhdQMg2Or4,546
@@ -817,9 +818,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
817
818
  meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
818
819
  meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
819
820
  meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
820
- MeUtils-2024.12.13.10.12.35.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
821
- MeUtils-2024.12.13.10.12.35.dist-info/METADATA,sha256=PJasJTKCnyoBEd3NIjbmR5sjrvAAEegwih4fwLmJ5Hc,6171
822
- MeUtils-2024.12.13.10.12.35.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
823
- MeUtils-2024.12.13.10.12.35.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
824
- MeUtils-2024.12.13.10.12.35.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
825
- MeUtils-2024.12.13.10.12.35.dist-info/RECORD,,
821
+ MeUtils-2024.12.13.15.17.40.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
822
+ MeUtils-2024.12.13.15.17.40.dist-info/METADATA,sha256=Czyi-b8w7qkiRkMvrTdzMuPRVG8NJcSQvi-YIeuo9tc,6203
823
+ MeUtils-2024.12.13.15.17.40.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
824
+ MeUtils-2024.12.13.15.17.40.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
825
+ MeUtils-2024.12.13.15.17.40.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
826
+ MeUtils-2024.12.13.15.17.40.dist-info/RECORD,,
examples/size_map.py ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : size_map
5
+ # @Time : 2024/12/13 15:03
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+
13
+
14
+ def find_nearest_standard_size(width, height, standard_sizes):
15
+ """
16
+ 找到最接近的标准尺寸
17
+ standard_sizes: 标准尺寸列表,如 [(256,256), (512,512), ...]
18
+ """
19
+ min_diff = float('inf')
20
+ nearest_size = None
21
+
22
+ for std_width, std_height in standard_sizes:
23
+ diff = abs(width - std_width) + abs(height - std_height)
24
+ if diff < min_diff:
25
+ min_diff = diff
26
+ nearest_size = (std_width, std_height)
27
+
28
+ return nearest_size
29
+
30
+
31
+ # 标准尺寸列表
32
+ standard_sizes = [
33
+ (256, 256),
34
+ (512, 512),
35
+ (1024, 1024),
36
+ (1792, 1024),
37
+ (1024, 1792)
38
+ ]
39
+
40
+ # 使用示例
41
+ width, height = 600, 600
42
+ nearest = find_nearest_standard_size(width, height, standard_sizes)
43
+ print(f"最接近 {width}x{height} 的标准尺寸是: {nearest}")
@@ -18,7 +18,10 @@ from fal_client import AsyncClient, SyncClient
18
18
  DEFAULT_MODEL = "fal-ai/flux-pro/v1.1-ultra"
19
19
  MODELS = {
20
20
  "flux-1.1-pro-ultra": "fal-ai/flux-pro/v1.1-ultra",
21
- "fal-ai/recraft-v3": "fal-ai/recraft-v3"
21
+ "flux-image-to-image": "fal-ai/flux/dev/image-to-image",
22
+
23
+ "recraft-v3": "fal-ai/recraft-v3",
24
+ "ideogram-v2": "fal-ai/ideogram/v2",
22
25
  }
23
26
 
24
27
 
@@ -7,27 +7,74 @@
7
7
  # @WeChat : meutils
8
8
  # @Software : PyCharm
9
9
  # @Description :
10
+ from functools import partial
11
+
10
12
  from meutils.pipe import *
13
+ from meutils.caches.redis_cache import cache
14
+ from meutils.llm.check_utils import check_token_for_siliconflow
15
+ from meutils.schemas.task_types import TaskResponse
11
16
  from meutils.schemas.siliconflow_types import BASE_URL, VideoRequest
12
17
  from meutils.config_utils.lark_utils import get_next_token_for_polling
18
+ from meutils.config_utils.manager import ConfigManager
13
19
 
14
20
  from openai import OpenAI, AsyncOpenAI
15
21
 
22
+ config_manager = ConfigManager("prd", "siliconflow-api")
23
+
24
+ FEISHU_URL_FREE = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=ICzCsC"
25
+
26
+ check_token = partial(check_token_for_siliconflow, threshold=0.01)
16
27
 
28
+
29
+ @cache(ttl=7 * 24 * 3600)
17
30
  async def create_task(request: VideoRequest, token: Optional[str] = None):
18
- token = token or await get_next_token_for_polling(FEISHU_URL_FREE)
31
+ token = token or await get_next_token_for_polling(FEISHU_URL_FREE, check_token=check_token, from_redis=True)
19
32
 
20
33
  payload = request.model_dump(exclude_none=True)
34
+ payload["model"] = "tencent/HunyuanVideo"
35
+
36
+ client = OpenAI(
37
+ base_url=BASE_URL,
38
+ api_key=token
39
+ )
40
+
41
+ response = client.post("/video/submit", cast_to=object, body=payload)
42
+ logger.debug(response)
43
+ task_id = response.get('requestId')
21
44
 
45
+ return TaskResponse(task_id=task_id, system_fingerprint=token)
46
+
47
+
48
+ async def get_task(task_id, token: str):
22
49
  client = OpenAI(
23
50
  base_url=BASE_URL,
24
51
  api_key=token
25
52
  )
53
+ payload = {"requestId": task_id}
54
+ response = client.post(f"/video/status", cast_to=object, body=payload)
55
+ logger.debug(response)
26
56
 
27
- resp = client.post("/video/submit", cast_to=object, body=payload)
28
- return resp # {'requestId': 'e6fdd5d6-288f-45b4-a760-ead691c43ca9'}
57
+ return TaskResponse(
58
+ task_id=task_id,
59
+ data=response.get("results"),
60
+ status=response.get("status"),
61
+ message=response.get("reason"),
62
+ )
29
63
 
30
64
 
31
65
  if __name__ == '__main__':
66
+ token = None
67
+ # tokens = config_manager.text.split()
68
+
69
+ # tokens_ = arun(check_token_for_siliconflow(tokens, threshold=0.01))
70
+
32
71
  token = "sk-raapiguffsnsxgkfiwfusjmbpcyqoxhcohhxaybflrnvpqjw"
33
- arun(create_task(VideoRequest(model="tencent/HunyuanVideo", prompt="a dog in the forest"), token=token))
72
+ arun(get_task("73a15e11-310f-4464-a9af-3ab84b201fff", token))
73
+
74
+ # token = "sk-oeptckzkhfzeidbtsqvbrvyrfdtyaaehubfwsxjytszbgohd"
75
+ # arun(get_task("5ea22f57-45f0-425c-9d1e-bf3dae7e1e81", token))
76
+
77
+ # arun(create_task(VideoRequest(model="tencent/HunyuanVideo", prompt="a dog in the forest."), token=token))
78
+
79
+
80
+
@@ -22,6 +22,9 @@ class ConfigManager(object):
22
22
  return cls._instance
23
23
 
24
24
  def __init__(self, namespace: str, data_id: str, group: str = "DEFAULT_GROUP", ):
25
+ self.data_id = data_id
26
+ self.group = group
27
+
25
28
  NACOS_URL = os.getenv("NACOS_URL")
26
29
  assert NACOS_URL
27
30
  if NACOS_URL:
@@ -36,22 +39,16 @@ class ConfigManager(object):
36
39
  password=password # 密码
37
40
  )
38
41
 
39
- self.init_config(data_id, group)
40
-
41
- def init_config(self, data_id: str, group: str = "DEFAULT_GROUP"):
42
+ def init_config(self):
42
43
  """初始化配置并添加监听器"""
43
44
  # 获取初始配置
44
- config = self.client.get_config(data_id, group)
45
+ config = self.client.get_config(self.data_id, self.group)
45
46
  logger.info(f"初始配置\n{config}")
46
47
  if config:
47
48
  self._config = config
48
49
 
49
50
  # 添加配置变更监听器
50
- self.client.add_config_watcher(
51
- data_id,
52
- group,
53
- self._config_changed_callback
54
- )
51
+ self.client.add_config_watcher(self.data_id, self.group, self._config_changed_callback)
55
52
 
56
53
  def _config_changed_callback(self, args):
57
54
  """配置变更回调函数"""
@@ -63,7 +60,7 @@ class ConfigManager(object):
63
60
  @property
64
61
  def text(self) -> str:
65
62
  """获取当前配置: 原始内容"""
66
- return self._config
63
+ return self._config or self.client.get_config(self.data_id, self.group)
67
64
 
68
65
  @property
69
66
  def json(self) -> Dict[str, Any]:
@@ -103,6 +100,9 @@ if __name__ == '__main__':
103
100
  namespace = 'test'
104
101
  data_id = "testdata"
105
102
 
103
+ namespace = 'prd'
104
+ data_id = "siliconflow-api"
105
+
106
106
  manager = ConfigManager(namespace, data_id)
107
107
  # manager_ = Manager(namespace, data_id, group)
108
108
 
meutils/data/VERSION CHANGED
@@ -1 +1 @@
1
- 2024.12.13.10.12.35
1
+ 2024.12.13.15.17.40
@@ -23,7 +23,6 @@ async def check_tokens(tokens, check_token: Callable):
23
23
 
24
24
 
25
25
  @retrying()
26
- @alru_cache(ttl=60)
27
26
  async def check_token_for_siliconflow(api_key, threshold: float = 0):
28
27
  if not isinstance(api_key, str):
29
28
  return await check_tokens(api_key, check_token_for_siliconflow)
@@ -6,7 +6,7 @@
6
6
  # @Author : betterme
7
7
  # @WeChat : meutils
8
8
  # @Software : PyCharm
9
- # @Description :
9
+ # @Description : todo: 通用比例适配
10
10
 
11
11
  from meutils.pipe import *
12
12
 
@@ -69,6 +69,7 @@ class RerankRequest(BaseModel):
69
69
  "examples": EXAMPLES
70
70
  }
71
71
 
72
+
72
73
  class VideoRequest(BaseModel):
73
74
  model: str
74
75
  prompt: str
@@ -76,4 +77,4 @@ class VideoRequest(BaseModel):
76
77
  seed: Optional[int] = None
77
78
 
78
79
  class Config:
79
- frozen = True
80
+ frozen = True
@@ -28,7 +28,7 @@ STATUSES = {
28
28
  "processing": "IN_PROGRESS",
29
29
  "in_progress": "IN_PROGRESS",
30
30
  "received": "IN_PROGRESS",
31
- "RECEIVED": "IN_PROGRESS",
31
+ "inprogress": "IN_PROGRESS",
32
32
 
33
33
  "succeed": "SUCCESS",
34
34
  "success": "SUCCESS",
@@ -22,6 +22,7 @@ from meutils.serving.fastapi.exceptions.http_error import http_error_handler, ch
22
22
  from meutils.serving.fastapi.exceptions.validation_error import http422_error_handler, validation_exception_handler
23
23
 
24
24
 
25
+
25
26
  class App(FastAPI):
26
27
 
27
28
  def __init__(self, **kwargs):
@@ -86,31 +87,6 @@ class App(FastAPI):
86
87
  **kwargs
87
88
  )
88
89
 
89
- @cached_property
90
- def limiter(self):
91
- """
92
- from meutils.serving.fastapi import App
93
- from fastapi import Request
94
-
95
- app = App()
96
-
97
- @app.get("/home")
98
- @app.limiter.limit("5/minute")
99
- async def homepage(request: Request): # 必须叫 request 。。。
100
- return "TEST"
101
- :return:
102
- """
103
- from slowapi.errors import RateLimitExceeded
104
- from slowapi import Limiter, _rate_limit_exceeded_handler
105
- from slowapi.util import get_remote_address
106
-
107
- limiter = Limiter(key_func=get_remote_address)
108
-
109
- self.state.limiter = limiter
110
- self.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
111
-
112
- return limiter
113
-
114
90
  def sentry_init(self):
115
91
  """https://qyyshop.com/info/767857.html"""
116
92
  import sentry_sdk
@@ -34,5 +34,7 @@ async def get_bearer_token(
34
34
  return auth.credentials
35
35
 
36
36
 
37
+ # todo: oneapi userinfo apikey info
38
+
37
39
  if __name__ == '__main__':
38
40
  pass
@@ -54,6 +54,7 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
54
54
 
55
55
  # 默认值
56
56
  reps = None
57
+ request_json = {}
57
58
  if isinstance(exc, (HTTPStatusError, APIStatusError)):
58
59
  status_code = exc.response.status_code or 500
59
60
 
@@ -64,13 +65,17 @@ async def chatfire_api_exception_handler(request: Request, exc: Exception):
64
65
  content=content,
65
66
  status_code=status_code,
66
67
  )
68
+ try:
69
+ request_json = await request.json()
70
+ except Exception as e:
71
+ request_json = {"error": f"json parse error: {e}"}
67
72
 
68
73
  # send_message
69
74
  content_detail = f"{traceback.format_exc()}"
70
75
  if any(code in content_detail for code in {'451', }):
71
76
  content_detail = ""
72
77
 
73
- send_message([content, content_detail])
78
+ send_message([request_json, content, content_detail])
74
79
 
75
80
  return reps or JSONResponse(
76
81
  content=content,
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : lifespans
5
+ # @Time : 2024/12/13 10:50
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+ from contextlib import asynccontextmanager
11
+
12
+ from meutils.pipe import *
13
+ from meutils.config_utils.manager import ConfigManager
14
+
15
+
16
+ class Resources(BaseModel):
17
+ config_manager: Optional[ConfigManager] = None
18
+
19
+ class Config:
20
+ # 允许额外字段,增加灵活性
21
+ extra = 'allow'
22
+ arbitrary_types_allowed = True
23
+
24
+
25
+ # def fake_answer_to_everything_ml_model(x: float):
26
+ # return x * 42
27
+ #
28
+ #
29
+ # ml_models = {}
30
+ #
31
+ #
32
+ # @asynccontextmanager
33
+ # async def lifespan(app):
34
+ # # Load the ML model
35
+ # ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
36
+ # yield
37
+ # # Clean up the ML models and release the resources
38
+ # ml_models.clear()
39
+
40
+
41
+ resources = Resources()
42
+
43
+
44
+ @asynccontextmanager
45
+ async def nacos_lifespan(app):
46
+ import gc
47
+
48
+ logger.debug("Init lifespans")
49
+
50
+ config_manager = ConfigManager("test", "testdata")
51
+
52
+ resources.config_manager = config_manager
53
+
54
+ yield
55
+
56
+ # release the resources
57
+ logger.debug("Release the resources")
58
+ del config_manager
59
+ gc.collect()
60
+
61
+
62
+ if __name__ == '__main__':
63
+ from fastapi import FastAPI
64
+
65
+ app = FastAPI(lifespan=lifespan)
66
+
67
+ app.state.config_manager = ConfigManager("test", "testdata")
68
+
69
+
70
+ @app.get("/predict")
71
+ async def predict(x: float):
72
+ result = ml_models["answer_to_everything"](x)
73
+ return {"result": result}
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # @Project : AI. @by PyCharm
4
- # @File : nacos
5
- # @Time : 2024/4/17 17:01
6
- # @Author : betterme
7
- # @WeChat : meutils
8
- # @Software : PyCharm
9
- # @Description : https://github.com/nacos-group/nacos-sdk-python
10
- # https://baijiahao.baidu.com/s?id=1774464887530962175&wfr=spider&for=pc
11
-
12
- from meutils.pipe import *
13
- import nacos # nacos-sdk-python
14
-
15
- # Both HTTP/HTTPS protocols are supported, if not set protocol prefix default is HTTP, and HTTPS with no ssl check(verify=False)
16
- # "192.168.3.4:8848" or "https://192.168.3.4:443" or "http://192.168.3.4:8848,192.168.3.5:8848" or "https://192.168.3.4:443,https://192.168.3.5:443"
17
- server_addresses = "nacos.chatfire.cc"
18
- NAMESPACE = "test"
19
-
20
- # no auth mode
21
- client = nacos.NacosClient(server_addresses=server_addresses, namespace=NAMESPACE, username='chatfire', password='chatfirechatfire')
22
- # auth mode
23
- # client = nacos.NacosClient(SERVER_ADDRESSES, namespace=NAMESPACE, ak="{ak}", sk="{sk}")
24
-
25
- # get config
26
- data_id = "testdata"
27
- group = "DEFAULT_GROUP"
28
- print(client.get_config(data_id, group))
29
-
30
-
31
-
32
-
File without changes
File without changes