MeUtils 2024.3.4.13.4.45__py3-none-any.whl → 2025.1.16.17.15.52__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.3.4.13.4.45.dist-info → MeUtils-2025.1.16.17.15.52.dist-info}/METADATA +38 -32
- MeUtils-2025.1.16.17.15.52.dist-info/RECORD +864 -0
- {MeUtils-2024.3.4.13.4.45.dist-info → MeUtils-2025.1.16.17.15.52.dist-info}/WHEEL +1 -1
- {MeUtils-2024.3.4.13.4.45.dist-info → MeUtils-2025.1.16.17.15.52.dist-info}/entry_points.txt +1 -0
- apps/spider.py +24 -8
- examples/_openaisdk/4v.py +110 -0
- examples/_openaisdk/__init__.py +11 -0
- examples/_openaisdk/baichuan.py +38 -0
- examples/_openaisdk/bpo.py +138 -0
- examples/_openaisdk/chat_latex.py +95 -0
- examples/_openaisdk/chattts.py +85 -0
- examples/_openaisdk/copilot.py +48 -0
- examples/_openaisdk/dalle3.py +48 -0
- examples/_openaisdk/deeplx.py +31 -0
- examples/_openaisdk/demo.py +77 -0
- examples/_openaisdk/embeddings.py +34 -0
- examples/_openaisdk/gpt4all.py +69 -0
- examples/_openaisdk/gpt_fc.py +23 -0
- examples/_openaisdk/gr_vl.py +46 -0
- examples/_openaisdk/json_mode.py +12 -0
- examples/_openaisdk/kimi.py +91 -0
- examples/_openaisdk/kimi_qa.py +57 -0
- examples/_openaisdk/minimax.py +75 -0
- examples/_openaisdk/open_router.py +48 -0
- examples/_openaisdk/openai_aiplus.py +54 -0
- examples/_openaisdk/openai_audio.py +20 -0
- examples/_openaisdk/openai_baichuan.py +59 -0
- examples/_openaisdk/openai_cache.py +37 -0
- examples/_openaisdk/openai_chatfire.py +228 -0
- examples/_openaisdk/openai_chatfire_all.py +166 -0
- examples/_openaisdk/openai_deepinfra.py +55 -0
- examples/_openaisdk/openai_deepseek.py +29 -0
- examples/_openaisdk/openai_doubao.py +43 -0
- examples/_openaisdk/openai_embeddings.py +36 -0
- examples/_openaisdk/openai_files.py +57 -0
- examples/_openaisdk/openai_gitee.py +33 -0
- examples/_openaisdk/openai_god.py +45 -0
- examples/_openaisdk/openai_groq.py +240 -0
- examples/_openaisdk/openai_images.py +203 -0
- examples/_openaisdk/openai_json.py +78 -0
- examples/_openaisdk/openai_lingyi.py +59 -0
- examples/_openaisdk/openai_modelscope.py +54 -0
- examples/_openaisdk/openai_moon.py +55 -0
- examples/_openaisdk/openai_oi.py +61 -0
- examples/_openaisdk/openai_ppu.py +47 -0
- examples/_openaisdk/openai_qwen.py +58 -0
- examples/_openaisdk/openai_search.py +42 -0
- examples/_openaisdk/openai_sensenova.py +81 -0
- examples/_openaisdk/openai_siliconflow.py +52 -0
- examples/_openaisdk/openai_step.py +45 -0
- examples/_openaisdk/openai_test.py +66 -0
- examples/_openaisdk/openai_together.py +57 -0
- examples/_openaisdk/openai_tune.py +38 -0
- examples/_openaisdk/openai_zhipu.py +59 -0
- examples/_openaisdk/ppu.py +28 -0
- examples/_openaisdk/rag.py +54 -0
- examples/_openaisdk/rag_.py +26 -0
- examples/_openaisdk/test.py +52 -0
- examples/_openaisdk/x.py +32 -0
- examples/_openaisdk/xx.py +29 -0
- examples/_openaisdk/zhipu_files.py +47 -0
- examples/_openaisdk/zhipu_/346/231/272/350/203/275/344/275/223.py +45 -0
- examples/_openaisdk//345/205/234/345/272/225/346/265/213/350/257/225.py +50 -0
- examples/_openaisdk//345/244/232/346/250/241/346/200/201/346/265/213/350/257/225.py +76 -0
- examples/_openaisdk//345/244/232/346/250/241/346/200/201/346/265/213/350/257/225_.py +56 -0
- examples/_openaisdk//346/226/207/344/273/266/351/227/256/347/255/224.py +36 -0
- examples/_openaisdk//346/226/207/346/241/243/350/247/243/346/236/220.py +34 -0
- examples/_openaisdk//346/250/241/345/236/213/346/265/213/350/257/225.py +53 -0
- examples/_openaisdk//351/230/277/351/207/214.py +80 -0
- {meutils/serving/jina/__demo → examples/ann}/__init__.py +1 -1
- examples/ann/main.py +31 -0
- examples/apis/kl.py +28 -0
- examples/apis/x.py +17 -0
- examples/apis/xx.py +17 -0
- examples/arq_demo/demo.py +3 -0
- examples/backgroundtasks.py +25 -0
- examples/bserver.py +513 -21
- examples/cache_demo/HermesCache_demo.py +81 -0
- examples/cache_demo/acacge.py +26 -0
- examples/cache_demo/x.py +31 -0
- {meutils/docarray_utils → examples/caches}/__init__.py +1 -1
- examples/caches/llmcache.py +18 -0
- examples/celery_demo/product_task.py +2 -0
- examples/demo.py +17 -1
- examples/fastapi_caching.py +59 -0
- {meutils/dependencies → examples/gr}/__init__.py +1 -1
- examples/gr/d.py +22 -0
- examples/gr/demo.py +30 -0
- examples/ip2/345/234/260/345/214/272.py +16 -0
- examples/jinja2_demo/j2_demo.py +20 -1
- examples/json/346/240/207/345/207/206/345/214/226.py +54 -0
- examples/md.py +29 -0
- {meutils/serving/jina → examples/nesc}/__init__.py +1 -1
- examples/nesc/main.py +76 -0
- examples/orm/mysql_orm.py +113 -0
- examples/orm/sql_creater.py +57 -0
- examples/orm/sqlm.py +134 -0
- examples/rq_demo/fns.py +18 -0
- examples/rq_demo/redis/351/230/237/345/210/227.py +14 -7
- examples/rq_demo/redis/351/230/237/345/210/227_add_chatfire.py +30 -0
- examples/size_map.py +43 -0
- examples/test.py +59 -0
- examples/webs/__init__.py +11 -0
- examples/webs/main.py +34 -0
- examples/x.py +13 -0
- examples//345/216/273/346/260/264/345/215/260.py +20 -0
- examples//346/226/207/346/241/243/346/231/272/350/203/275/__init__.py +11 -0
- meutils/_utils.py +15 -6
- meutils/ai_audio/asr/__init__.py +3 -2
- meutils/ai_audio/asr/cf_asr.py +53 -0
- meutils/ai_audio/asr/de.py +11 -0
- meutils/ai_audio/asr/fast_asr.py +15 -7
- meutils/ai_audio/asr/openai_asr.py +83 -6
- meutils/ai_audio/fast_asr.py +8 -4
- meutils/ai_audio/tts/EdgeTTS.py +33 -7
- meutils/ai_audio/tts/openai_tts.py +24 -20
- meutils/ai_audio/tts/tts_ui.py +1 -0
- meutils/ai_audio/utils.py +9 -0
- meutils/ai_cv/__init__.py +0 -1
- meutils/ai_cv/ocr.py +3 -2
- meutils/ai_cv/utils.py +154 -0
- meutils/ai_video/avmerge.py +6 -0
- meutils/ai_video/video.py +11 -2
- meutils/{api → apis}/__init__.py +1 -1
- meutils/apis/ali_apis.py +60 -0
- meutils/apis/audio/__init__.py +10 -0
- meutils/apis/audio/deepinfra.py +59 -0
- meutils/apis/audio/fish.py +248 -0
- meutils/apis/baidu/__init__.py +9 -0
- meutils/apis/baidu/bdaitpzs.py +229 -0
- meutils/apis/baidu/test.py +78 -0
- meutils/apis/chatglm/__init__.py +11 -0
- meutils/apis/chatglm/glm_video.py +273 -0
- meutils/apis/chatglm/glm_video_api.py +116 -0
- meutils/apis/chatglm/images.py +63 -0
- meutils/apis/chatglm/temp.py +259 -0
- meutils/apis/chatglm/x.py +31 -0
- meutils/{api → apis}/common.py +10 -6
- meutils/apis/fal/__init__.py +11 -0
- meutils/apis/fal/files.py +53 -0
- meutils/apis/fal/images.py +57 -0
- meutils/apis/fal/images_.py +72 -0
- meutils/apis/fal/videos.py +77 -0
- meutils/apis/firecrawl.py +45 -0
- meutils/apis/gitee/__init__.py +11 -0
- meutils/apis/gitee/images/__init__.py +9 -0
- meutils/apis/gitee/images/kolors.py +99 -0
- meutils/apis/hailuoai/__init__.py +11 -0
- meutils/apis/hailuoai/demo.py +34 -0
- meutils/apis/hailuoai/hasha_new.py +248 -0
- meutils/apis/hailuoai/music.py +11 -0
- meutils/apis/hailuoai/upload.py +116 -0
- meutils/apis/hailuoai/videos.py +460 -0
- meutils/apis/hailuoai/yy.py +242 -0
- meutils/apis/hf/__init__.py +11 -0
- meutils/apis/hf/got_ocr.py +64 -0
- meutils/apis/hf/gradio.py +34 -0
- meutils/apis/hf/hivisionidphotos.py +80 -0
- meutils/apis/hf/kolors.py +68 -0
- meutils/apis/hf/kolors_virtual_try_on.py +107 -0
- meutils/apis/hf/r.py +53 -0
- meutils/apis/hf/x.py +26 -0
- meutils/apis/hf//350/257/201/344/273/266/347/205/247.py +41 -0
- meutils/apis/hunyuan/__init__.py +11 -0
- meutils/apis/hunyuan/image_tools.py +84 -0
- meutils/apis/images/__init__.py +11 -0
- meutils/apis/images/deepinfra.py +92 -0
- meutils/apis/images/demo.py +150 -0
- meutils/apis/images/eidt.py +36 -0
- meutils/apis/images/flux/__init__.py +11 -0
- meutils/apis/images/flux/fluxpro.py +108 -0
- meutils/apis/images/flux/mystic.py +116 -0
- meutils/apis/images/ideogram/__init__.py +10 -0
- meutils/apis/images/ideogram/ideogram_images.py +193 -0
- meutils/apis/images/prodia/__init__.py +12 -0
- meutils/apis/images/prodia/faceswap.py +76 -0
- meutils/apis/images/recraft.py +152 -0
- meutils/apis/images/virtual_try_on/__init__.py +11 -0
- meutils/apis/images/virtual_try_on/images.py +65 -0
- meutils/apis/jiema/24mail.py +96 -0
- meutils/apis/jiema/__init__.py +11 -0
- meutils/apis/jiema/yezi.py +97 -0
- meutils/apis/jimeng/__init__.py +11 -0
- meutils/apis/jimeng/common.py +328 -0
- meutils/apis/jimeng/doubao.py +68 -0
- meutils/apis/jimeng/doubao_utils.py +175 -0
- meutils/apis/jimeng/files.py +263 -0
- meutils/apis/jimeng/images.py +140 -0
- meutils/apis/jimeng/lip_sync.py +11 -0
- meutils/apis/jina.py +55 -0
- meutils/apis/kling/__init__.py +11 -0
- meutils/apis/kling/api.py +60 -0
- meutils/apis/kling/images.py +174 -0
- meutils/apis/kling/kolors_virtual_try_on.py +111 -0
- meutils/apis/kling/kolors_virtual_try_on_web.py +126 -0
- meutils/apis/kling/videos.py +67 -0
- meutils/apis/kling//351/211/264/346/235/203.py +34 -0
- meutils/apis/kuaidi.py +32 -0
- meutils/apis/kuaishou/__init__.py +10 -0
- meutils/apis/kuaishou/klingai.py +523 -0
- meutils/apis/kuaishou/klingai_video.py +197 -0
- meutils/apis/kuaishou/kolors.py +189 -0
- meutils/apis/llm_qa.py +55 -0
- meutils/apis/luma/__init__.py +11 -0
- meutils/apis/luma/luma.py +123 -0
- meutils/apis/minicpm/__init__.py +9 -0
- meutils/apis/minicpm/luca.py +137 -0
- meutils/apis/monica/__init__.py +11 -0
- meutils/apis/monica/llm.py +11 -0
- meutils/apis/napkin/__init__.py +11 -0
- meutils/apis/napkin/icons.py +42 -0
- meutils/apis/niutrans.py +73 -0
- meutils/apis/oneapi/__init__.py +11 -0
- meutils/apis/oneapi/channel.py +68 -0
- meutils/apis/oneapi/common.py +135 -0
- meutils/apis/oneapi/log.py +47 -0
- meutils/apis/oneapi/token.py +48 -0
- meutils/apis/oneapi/token_.py +112 -0
- meutils/apis/oneapi/user.py +100 -0
- meutils/apis/oneapi/utils.py +47 -0
- meutils/apis/pixverse/__init__.py +11 -0
- meutils/apis/pixverse/pixverse.py +150 -0
- meutils/apis/proxy/__init__.py +11 -0
- meutils/apis/proxy/ips.py +178 -0
- meutils/apis/remini/__init__.py +11 -0
- meutils/apis/remini/remini.py +89 -0
- meutils/apis/replicateai/__init__.py +11 -0
- meutils/apis/replicateai/images.py +79 -0
- meutils/apis/replicateai/raw.py +53 -0
- meutils/apis/runwayml/__init__.py +10 -0
- meutils/apis/runwayml/gen.py +143 -0
- meutils/apis/search/__init__.py +11 -0
- meutils/apis/search/baichuan.py +11 -0
- meutils/apis/search/metaso.py +218 -0
- meutils/apis/search/metaso_.py +77 -0
- meutils/apis/search/n.py +99 -0
- meutils/apis/search/searxng.py +42 -0
- meutils/apis/search_music.py +39 -0
- meutils/apis/siliconflow/__init__.py +9 -0
- meutils/apis/siliconflow/audio.py +63 -0
- meutils/apis/siliconflow/image_to_image.py +116 -0
- meutils/apis/siliconflow/images.py +154 -0
- meutils/apis/siliconflow/rerankers.py +40 -0
- meutils/apis/siliconflow/text_to_image.py +132 -0
- meutils/apis/siliconflow/utils.py +66 -0
- meutils/apis/siliconflow/videos.py +102 -0
- meutils/apis/sunoai/__init__.py +10 -0
- meutils/apis/sunoai/haimian.py +135 -0
- meutils/apis/sunoai/suno.py +373 -0
- meutils/apis/textcard/__init__.py +11 -0
- meutils/apis/textcard/demo.py +25 -0
- meutils/apis/textcard/hanyuxinjie.py +81 -0
- meutils/apis/textin.py +159 -0
- meutils/apis/to_image/__init__.py +11 -0
- meutils/apis/to_image/html2image.py +29 -0
- meutils/apis/to_image/md.py +29 -0
- meutils/apis/to_image/url2image.py +41 -0
- meutils/apis/together/__init__.py +11 -0
- meutils/apis/together/images.py +80 -0
- meutils/apis/translator/__init__.py +9 -0
- meutils/apis/translator/deeplx.py +55 -0
- meutils/apis/tripo3d/__init__.py +11 -0
- meutils/apis/tripo3d/images.py +106 -0
- meutils/apis/ts.py +60 -0
- meutils/apis/uptime_kuma/__init__.py +11 -0
- meutils/apis/uptime_kuma/common.py +56 -0
- meutils/apis/uptime_kuma//345/233/275/344/272/247/345/210/206/347/273/204.py +68 -0
- meutils/apis/utils.py +47 -0
- meutils/apis/videos/__init__.py +11 -0
- meutils/apis/videos/sora.py +16 -0
- meutils/apis/vidu/__init__.py +9 -0
- meutils/apis/vidu/vidu_video.py +254 -0
- meutils/apis/vidu/x.py +14 -0
- meutils/apis/voice_clone/__init__.py +10 -0
- meutils/apis/voice_clone/fish.py +236 -0
- meutils/apis/voice_clone/fish_api.py +16 -0
- meutils/apis/web_search.py +31 -0
- meutils/apis/yezi.py +97 -0
- meutils/async_task/__init__.py +13 -0
- meutils/async_task/celery_config.py +106 -0
- meutils/async_task/common.py +37 -0
- meutils/async_task/demo_create_tasks.py +73 -0
- meutils/async_task/tasks/__init__.py +11 -0
- meutils/async_task/tasks/_all.py +20 -0
- meutils/async_task/tasks/hailuo.py +24 -0
- meutils/async_task/tasks/kling.py +30 -0
- meutils/async_task/tasks/replicateai.py +24 -0
- meutils/async_task/tasks/test.py +124 -0
- meutils/async_task/tasks/vidu.py +28 -0
- meutils/async_task/utils.py +191 -0
- meutils/async_task//351/200/232/347/224/250/350/256/276/350/256/241.py +119 -0
- meutils/async_utils/asyncer_.py +37 -0
- meutils/async_utils/background.py +68 -0
- meutils/async_utils/common.py +136 -16
- meutils/async_utils/test.py +47 -0
- meutils/cache_utils.py +29 -23
- meutils/caches/__init__.py +9 -0
- meutils/caches/acache.py +45 -0
- meutils/caches/redis_cache.py +63 -0
- meutils/clis/check_api.py +66 -0
- meutils/clis/cli.py +1 -1
- meutils/common.py +56 -17
- meutils/config_utils/__init__.py +11 -0
- meutils/config_utils/lark_utils/__init__.py +11 -0
- meutils/config_utils/lark_utils/common.py +385 -0
- meutils/config_utils/lark_utils/demo.py +13 -0
- meutils/config_utils/lark_utils/x.py +50 -0
- meutils/config_utils/manager.py +108 -0
- meutils/crawlers/__init__.py +11 -0
- meutils/data/VERSION +1 -1
- meutils/data/cowboy-hat-face.webp +0 -0
- meutils/data/oneapi/FOOTER.md +7 -0
- meutils/data/oneapi/NOTICE.md +138 -0
- meutils/data/oneapi/__init__.py +15 -0
- meutils/db/orm.py +179 -0
- meutils/db/redis_db.py +87 -0
- meutils/decorators/cache.py +1 -1
- meutils/decorators/common.py +84 -5
- meutils/decorators/contextmanagers.py +17 -6
- meutils/decorators/fastapi_decorator.py +77 -3
- meutils/decorators/polling.py +46 -0
- meutils/decorators/retry.py +150 -26
- meutils/fastapi_utils/__init__.py +11 -0
- meutils/fastapi_utils/exceptions/http_error.py +72 -0
- meutils/fastapi_utils/exceptions/validation_error.py +44 -0
- meutils/hash_utils.py +9 -4
- meutils/hooks/__init__.py +11 -0
- meutils/hooks/hook_test.py +174 -0
- meutils/hooks/wechat.py +162 -0
- meutils/hooks/wechat_channel.py +303 -0
- meutils/init/evn.py +1 -1
- meutils/io/files_utils.py +232 -0
- meutils/io/image.py +148 -10
- meutils/io/x.py +75 -0
- meutils/llm/__init__.py +10 -0
- meutils/llm/check_api.py +109 -0
- meutils/llm/check_utils.py +106 -0
- meutils/llm/clients.py +38 -0
- meutils/llm/completions/__init__.py +11 -0
- meutils/llm/completions/agents/__init__.py +11 -0
- meutils/llm/completions/agents/file.py +125 -0
- meutils/llm/completions/cp.py +112 -0
- meutils/llm/completions/delilegal.py +135 -0
- meutils/llm/completions/dify.py +81 -0
- meutils/llm/completions/kimi.py +47 -0
- meutils/llm/completions/modelscope.py +11 -0
- meutils/{fileparser/filetype.py → llm/completions/oi.py} +5 -3
- meutils/llm/completions/rag/__init__.py +11 -0
- meutils/llm/completions/rag/fire.py +157 -0
- meutils/llm/completions/rag/qwen.py +11 -0
- meutils/llm/completions/rag/rag.py +41 -0
- meutils/llm/completions/rag.py +38 -0
- meutils/llm/completions/tryblend.py +201 -0
- meutils/llm/completions/tune.py +284 -0
- meutils/llm/completions/x.py +26 -0
- meutils/llm/completions/xx.py +61 -0
- meutils/llm/completions/yuanbao.py +176 -0
- meutils/llm/demo.py +114 -0
- meutils/llm/functions/__init__.py +11 -0
- meutils/llm/mappers.py +15 -0
- meutils/llm/openai_utils/__init__.py +11 -0
- meutils/llm/openai_utils/common.py +284 -0
- meutils/llm/openai_utils/tool_outputs.py +45 -0
- meutils/llm/output_parsers/__init__.py +80 -0
- meutils/llm/prompts/__init__.py +244 -0
- meutils/llm/prompts/demo.py +155 -0
- meutils/llm/prompts/html2image_test.py +19 -0
- meutils/llm/utils.py +133 -0
- meutils/llm/x.py +75 -0
- meutils/notice/feishu.py +40 -9
- meutils/notice/wechat.py +23 -21
- meutils/np_utils.py +10 -1
- meutils/office_automation/pdf.py +6 -1
- meutils/oss/__init__.py +20 -0
- meutils/oss/minio_oss.py +184 -0
- meutils/oss/minio_utils.py +48 -0
- meutils/other/__demo.py +6 -4
- meutils/pandas_utils/__init__.py +1 -0
- meutils/pandas_utils/common.py +31 -0
- meutils/pandas_utils/pd_utils.py +10 -6
- meutils/parsers/__init__.py +10 -0
- meutils/parsers/file_parsers.py +110 -0
- meutils/parsers/fileparser/demo.py +41 -0
- meutils/parsers/fileparser/filetype.py +41 -0
- meutils/pay.py +37 -0
- meutils/pipe.py +37 -4
- meutils/playwright_utils/common.py +20 -12
- meutils/plots/common.py +35 -34
- meutils/queues/demo.py +56 -0
- meutils/queues/smooth_queue.py +120 -0
- meutils/queues/uniform_queue.py +3 -1
- meutils/request_utils/__init__.py +26 -2
- meutils/request_utils/ark.py +47 -0
- meutils/request_utils/crawler.py +34 -5
- meutils/request_utils/jwt_utils/__init__.py +11 -0
- meutils/request_utils/jwt_utils/common.py +42 -0
- meutils/request_utils/volc.py +160 -0
- meutils/schemas/__init__.py +0 -1
- meutils/schemas/baidu_types.py +70 -0
- meutils/schemas/batch_types.py +450 -0
- meutils/schemas/celery_types.py +64 -0
- meutils/schemas/chatfire_types.py +15 -0
- meutils/schemas/chatglm_types.py +197 -0
- meutils/schemas/db/__init__.py +11 -0
- meutils/schemas/db/oneapi_types.py +117 -0
- meutils/schemas/dify_types.py +40 -0
- meutils/schemas/embedding.py +31 -0
- meutils/schemas/fal_types.py +13 -0
- meutils/schemas/fish_types.py +11 -0
- meutils/schemas/hailuo_types.py +208 -0
- meutils/schemas/haimian_types.py +51 -0
- meutils/schemas/idphoto_types.py +43 -0
- meutils/schemas/image_types.py +476 -0
- meutils/schemas/jimeng_types.py +28 -0
- meutils/schemas/jina_types.py +67 -0
- meutils/schemas/kimi_types.py +86 -0
- meutils/schemas/kling_types.py +235 -0
- meutils/schemas/kuaishou_types.py +328 -0
- meutils/schemas/luma_types.py +59 -0
- meutils/schemas/message_types.py +165 -0
- meutils/schemas/message_types_.py +219 -0
- meutils/schemas/metaso_types.py +64 -0
- meutils/schemas/napkin_types.py +85 -0
- meutils/schemas/ocr_types.py +37 -0
- meutils/schemas/oneapi/__init__.py +11 -0
- meutils/schemas/oneapi/_types.py +49 -0
- meutils/schemas/oneapi/common.py +883 -0
- meutils/schemas/oneapi/icons.py +30 -0
- meutils/schemas/oneapi/model_group_info.py +48 -0
- meutils/schemas/oneapi/model_info.py +34 -0
- meutils/schemas/oneapi/models.py +26 -0
- meutils/schemas/oneapi/x.py +26 -0
- meutils/schemas/oneapi//351/207/215/345/256/232/345/220/221.py +132 -0
- meutils/schemas/openai_api_protocol.py +411 -0
- meutils/schemas/openai_types.py +366 -0
- meutils/schemas/pixverse_types.py +88 -0
- meutils/schemas/playwright_types.py +57 -0
- meutils/schemas/prodia_types.py +19 -0
- meutils/schemas/replicate_types.py +112 -0
- meutils/schemas/request_types.py +20 -0
- meutils/schemas/runwayml_types.py +190 -0
- meutils/schemas/siliconflow_types.py +80 -0
- meutils/schemas/step_types.py +19 -0
- meutils/schemas/suno_types.py +319 -0
- meutils/schemas/task_types.py +192 -0
- meutils/schemas/translator_types.py +29 -0
- meutils/schemas/tripo3d_types.py +57 -0
- meutils/schemas/tryblend_types.py +51 -0
- meutils/schemas/video_types.py +62 -0
- meutils/schemas/vidu_types.py +350 -0
- meutils/schemas/wechat_types.py +316 -0
- meutils/schemas/yuanbao_types.py +260 -0
- meutils/serving/celery/__init__.py +8 -0
- meutils/serving/celery/config.py +115 -0
- meutils/serving/celery/router.py +4 -6
- meutils/serving/celery/tasks.py +6 -4
- meutils/serving/celery//351/200/232/347/224/250/350/256/276/350/256/241.py +119 -0
- meutils/serving/fastapi/common.py +27 -31
- meutils/serving/fastapi/dependencies/__init__.py +0 -1
- meutils/serving/fastapi/dependencies/auth.py +55 -2
- meutils/serving/fastapi/exceptions/http_error.py +67 -2
- meutils/serving/fastapi/exceptions/validation_error.py +18 -2
- meutils/serving/fastapi/lifespans.py +73 -0
- meutils/serving/fastapi/routers/scheduler.py +12 -0
- meutils/serving/fastapi/routers/screenshot.py +47 -0
- meutils/serving/fastapi/routers/spider.py +8 -3
- meutils/serving/fastapi/routers/task.py +48 -0
- meutils/serving/fastapi/utils.py +48 -1
- meutils/serving/streamlit/common.py +1 -1
- meutils/smooth_utils.py +3 -0
- meutils/str_utils/__init__.py +22 -3
- meutils/str_utils/json_utils.py +7 -0
- meutils/str_utils/regular_expression.py +102 -10
- meutils/templates/xx.html +21 -0
- meutils/templates/xxx.html +117 -0
- meutils/todo.py +12 -0
- meutils/tools/token_monitor.py +33 -0
- MeUtils-2024.3.4.13.4.45.dist-info/RECORD +0 -540
- meutils/ai_audio/asr/subtitle.srt +0 -40
- meutils/ai_audio/demo.ipynb +0 -1215
- meutils/ai_audio/example.srt +0 -348
- meutils/ai_audio/new.srt +0 -179
- meutils/ai_audio/subtitles.srt +0 -696
- meutils/ai_audio/tts/new.srt +0 -179
- meutils/ai_audio//350/247/206/351/242/221/345/220/210/345/271/266.sh +0 -32
- meutils/ai_cv/1.jpg +0 -0
- meutils/ai_cv/197.jpg +0 -0
- meutils/ai_cv/2.jpg +0 -0
- meutils/ai_cv/img.png +0 -0
- meutils/ai_cv/invoice.jpg +0 -0
- meutils/ai_cv/tbl.png +0 -0
- meutils/ai_cv/test.png +0 -0
- meutils/ann/README.md +0 -33
- meutils/ann/README_gensim.md +0 -47
- meutils/ann/examples/client.py +0 -59
- meutils/ann/examples/demo.py +0 -24
- meutils/api/deeplx.py +0 -29
- meutils/api/qr.png +0 -0
- meutils/clis/README.md +0 -29
- meutils/clis/__test.sh +0 -17
- meutils/clis/deepseek.txt +0 -8
- meutils/clis/deepseek_13003330042.json +0 -1
- meutils/clis/deepseek_13003872192.json +0 -1
- meutils/clis/deepseek_13852263862.json +0 -1
- meutils/clis/deepseek_13913898681.json +0 -1
- meutils/clis/deepseek_13962978617.json +0 -1
- meutils/clis/deepseek_15251801790.json +0 -1
- meutils/clis/deepseek_15720826383.json +0 -1
- meutils/clis/deepseek_18395563611.json +0 -1
- meutils/clis/deepseek_313303303@qq.com.json +0 -1
- meutils/clis/kimi_state.json +0 -1
- meutils/cmds/README.md +0 -55
- meutils/coding/__init__.py +0 -11
- meutils/coding/find132.py +0 -40
- meutils/db/README.md +0 -51
- meutils/decorators/README.md +0 -17
- meutils/docarray_utils/demo_es.py +0 -34
- meutils/docarray_utils/demo_hnsw.py +0 -55
- meutils/docarray_utils/in_memory.py +0 -38
- meutils/docarray_utils//346/224/271/351/200/240/344/270/213hnsw.py +0 -43
- meutils/io/file.py +0 -20
- meutils/io/img.png +0 -0
- meutils/io/x.yml +0 -1
- meutils/notice/img.png +0 -0
- meutils/notice/todo.md +0 -10
- meutils/office_automation//346/212/225/350/265/204/347/256/241/347/220/206/347/263/273/347/273/237O3.2_/344/272/244/346/230/223/347/273/204.pdm +0 -22469
- meutils/playwright_utils/__test.sh +0 -2
- meutils/playwright_utils/kimi1_cookies.json +0 -1
- meutils/playwright_utils/kimi2_cookies.json +0 -1
- meutils/playwright_utils/kimi_cookies.json +0 -93
- meutils/serving/README.md +0 -1
- meutils/serving/celery/_run.sh +0 -10
- meutils/serving/gui/run.sh +0 -9
- meutils/serving/jina/__demo/client.py +0 -42
- meutils/serving/jina/__demo/flow.svg +0 -1
- meutils/serving/jina/__demo/s.py +0 -34
- meutils/serving/jina/__demo/s2.py +0 -37
- meutils/serving/jina/__demo/server.py +0 -83
- meutils/serving/jina/__demo/test.py +0 -40
- meutils/serving/jina/executors/SentenceEncoder.py +0 -62
- meutils/serving/jina/executors/SentenceEncoder_.py +0 -63
- meutils/serving/jina/executors/__init__.py +0 -46
- meutils/serving/jina/executors/base.py +0 -40
- meutils/serving/jina/nlp_serving/__init__.py +0 -11
- meutils/serving/jina/nlp_serving/word_segmentation.py +0 -40
- meutils/serving/streamlit/conf.yaml +0 -5
- meutils/serving/streamlit/ocr.png +0 -0
- meutils/serving/streamlit/run.sh +0 -17
- meutils/serving/webui/.streamlit/_config.toml +0 -186
- meutils/serving/webui/.streamlit/config.toml +0 -26
- meutils/serving/webui/pages/_1_/345/210/206/350/257/215.py +0 -56
- meutils/serving/webui/pages/_2_/350/257/215/346/200/247/346/240/207/346/263/250/344/270/216/345/256/236/344/275/223/350/257/206/345/210/253.py +0 -54
- meutils/serving/webui/pages/_3_/346/226/207/346/234/254/345/214/271/351/205/215.py +0 -64
- meutils/serving/webui/run.sh +0 -9
- meutils/spark/__init__.py +0 -26
- meutils/tools/monitor.yml +0 -29
- {MeUtils-2024.3.4.13.4.45.dist-info → MeUtils-2025.1.16.17.15.52.dist-info}/LICENSE +0 -0
- {MeUtils-2024.3.4.13.4.45.dist-info → MeUtils-2025.1.16.17.15.52.dist-info}/top_level.txt +0 -0
- {meutils → examples}/comp_utils/__init__.py +0 -0
- {meutils → examples}/comp_utils/reverse_metric.py +0 -0
- /meutils/{fileparser/README.md → fastapi_utils/exceptions/__init__.py} +0 -0
- /meutils/{fileparser → parsers/fileparser}/PDF/346/212/275/345/217/226.py" +0 -0
- /meutils/{fileparser → parsers/fileparser}/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/common.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/__main__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/filetype.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/helpers.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/match.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/__init__.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/application.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/archive.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/audio.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/base.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/document.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/font.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/image.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/isobmff.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/types/video.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/filetype/utils.py +0 -0
- /meutils/{fileparser → parsers/fileparser}/pdf.py +0 -0
- /meutils/{fileparser → parsers/fileparser}//350/241/250/346/240/274/346/212/275/345/217/226.py" +0 -0
@@ -0,0 +1,254 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : vidu_video
|
5
|
+
# @Time : 2024/7/31 08:59
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description : todo 测试 https://oss-shanghai.sanwubeixin.cn/ios/110580373/20241126133701.png
|
10
|
+
import asyncio
|
11
|
+
|
12
|
+
from meutils.pipe import *
|
13
|
+
from meutils.decorators.retry import retrying
|
14
|
+
|
15
|
+
from meutils.schemas.vidu_types import BASE_URL, UPLOAD_BASE_URL, ViduRequest, ViduUpscaleRequest
|
16
|
+
from meutils.schemas.task_types import TaskType, Task, FileTask
|
17
|
+
|
18
|
+
from meutils.notice.feishu import send_message as _send_message
|
19
|
+
from meutils.config_utils.lark_utils import get_next_token_for_polling, get_spreadsheet_values
|
20
|
+
|
21
|
+
# FEISHU_URL = "https://xchatllm.feishu.cn/sheets/Bmjtst2f6hfMqFttbhLcdfRJnNf?sheet=l3VpZf"
|
22
|
+
FEISHU_URL = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=V84y6z"
|
23
|
+
FEISHU_URL_VIP = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=EYgZ8c"
|
24
|
+
|
25
|
+
send_message = partial(
|
26
|
+
_send_message,
|
27
|
+
title=__name__,
|
28
|
+
url="https://open.feishu.cn/open-apis/bot/v2/hook/dc1eda96-348e-4cb5-9c7c-2d87d584ca18"
|
29
|
+
)
|
30
|
+
|
31
|
+
|
32
|
+
async def upload(file, token: Optional[str] = None, vip: bool = False): # todo: 统一到 file object
|
33
|
+
token = token or await get_next_token_for_polling(
|
34
|
+
FEISHU_URL_VIP if vip else FEISHU_URL,
|
35
|
+
check_token=check_token,
|
36
|
+
from_redis=True,
|
37
|
+
min_points=4 # 最小消耗
|
38
|
+
)
|
39
|
+
|
40
|
+
token = token.strip(";Shunt=").strip("; Shunt=")
|
41
|
+
logger.debug(token)
|
42
|
+
|
43
|
+
payload = {"scene": "vidu"}
|
44
|
+
headers = {
|
45
|
+
"Cookie": token # ;Shunt= 居然失效
|
46
|
+
}
|
47
|
+
async with httpx.AsyncClient(base_url=UPLOAD_BASE_URL, headers=headers, timeout=60) as client:
|
48
|
+
response = await client.post("/files/uploads", json=payload)
|
49
|
+
if response.is_success:
|
50
|
+
logger.debug(response.json())
|
51
|
+
file_id = response.json()['id']
|
52
|
+
put_url = response.json()['put_url'] # 图片url
|
53
|
+
|
54
|
+
response = await client.put(put_url, content=file, headers=headers)
|
55
|
+
etag = response.headers.get('Etag')
|
56
|
+
|
57
|
+
payload = {"id": file_id, "etag": etag}
|
58
|
+
response = await client.put(f"/files/uploads/{file_id}/finish", json=payload)
|
59
|
+
logger.debug(response.text)
|
60
|
+
logger.debug(response.status_code)
|
61
|
+
logger.debug(put_url.split('?')[0])
|
62
|
+
if response.is_success:
|
63
|
+
uri = response.json()['uri']
|
64
|
+
return FileTask(id=file_id, url=put_url, system_fingerprint=token)
|
65
|
+
|
66
|
+
response.raise_for_status()
|
67
|
+
|
68
|
+
|
69
|
+
@retrying(max_retries=8, max=8, predicate=lambda r: r is True, title=__name__) # 触发重试
|
70
|
+
async def create_task(request: ViduRequest, token: Optional[str] = None, vip: bool = False):
|
71
|
+
token = token or await get_next_token_for_polling(
|
72
|
+
FEISHU_URL_VIP if vip else FEISHU_URL,
|
73
|
+
check_token=check_token,
|
74
|
+
from_redis=True,
|
75
|
+
min_points=4 # 最小消耗
|
76
|
+
)
|
77
|
+
|
78
|
+
token = token.strip(";Shunt=").strip("; Shunt=")
|
79
|
+
|
80
|
+
task_type = TaskType.vidu_vip if vip else TaskType.vidu
|
81
|
+
|
82
|
+
headers = {
|
83
|
+
"Cookie": token
|
84
|
+
}
|
85
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=60) as client:
|
86
|
+
response = await client.post("/tasks", json=request.payload)
|
87
|
+
|
88
|
+
logger.debug(response.text)
|
89
|
+
logger.debug(response.status_code)
|
90
|
+
|
91
|
+
if response.status_code in {429, 403} or "insufficient" in response.text: # 触发重试
|
92
|
+
return True
|
93
|
+
|
94
|
+
if response.is_success:
|
95
|
+
data = response.json()
|
96
|
+
task_id = f"{task_type}-{data['id']}"
|
97
|
+
return Task(id=task_id, data=data, system_fingerprint=token)
|
98
|
+
else:
|
99
|
+
logger.debug(token)
|
100
|
+
return Task(data=response.text, status=0, status_code=response.status_code)
|
101
|
+
|
102
|
+
|
103
|
+
@retrying(max_retries=8, max=8, predicate=lambda r: r is True, title=__name__) # 触发重试
|
104
|
+
async def create_task_upscale(request: ViduUpscaleRequest, token: str):
|
105
|
+
payload = {
|
106
|
+
"input": {
|
107
|
+
"creation_id": str(request.creation_id)
|
108
|
+
},
|
109
|
+
"type": "upscale",
|
110
|
+
"settings": {"model": "stable", "duration": 4} #######
|
111
|
+
}
|
112
|
+
headers = {
|
113
|
+
"Cookie": token
|
114
|
+
}
|
115
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=60) as client:
|
116
|
+
response = await client.post("/tasks", json=payload)
|
117
|
+
|
118
|
+
if response.status_code in {429} and "insufficient" in response.text: # 触发重试
|
119
|
+
return True
|
120
|
+
|
121
|
+
if response.is_success:
|
122
|
+
data = response.json()
|
123
|
+
task_id = f"vidu-{data['id']}"
|
124
|
+
return Task(id=task_id, data=data, system_fingerprint=token)
|
125
|
+
else:
|
126
|
+
return Task(data=response.text, status=0, status_code=response.status_code)
|
127
|
+
|
128
|
+
|
129
|
+
@retrying(max_retries=3, title=__name__)
|
130
|
+
async def get_task(task_id: str, token: str): # https://api.vidu.studio/vidu/v1/tasks/state?id=2375528561004183
|
131
|
+
task_id = task_id.split("-", 1)[-1]
|
132
|
+
|
133
|
+
token = token.strip(";Shunt=").strip("; Shunt=")
|
134
|
+
|
135
|
+
headers = {
|
136
|
+
"Cookie": token
|
137
|
+
}
|
138
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=60) as client:
|
139
|
+
response = await client.get(f"/tasks/{task_id}")
|
140
|
+
|
141
|
+
logger.debug(response.text)
|
142
|
+
logger.debug(response.status_code)
|
143
|
+
|
144
|
+
if response.is_success:
|
145
|
+
data = response.json()
|
146
|
+
return data
|
147
|
+
response.raise_for_status()
|
148
|
+
|
149
|
+
|
150
|
+
@retrying(title=__name__)
|
151
|
+
@alru_cache(ttl=10)
|
152
|
+
async def get_credits(token: str):
|
153
|
+
headers = {
|
154
|
+
"Cookie": token.rstrip(";Shunt=").strip("; Shunt="),
|
155
|
+
}
|
156
|
+
|
157
|
+
async with httpx.AsyncClient(headers=headers, timeout=60) as client:
|
158
|
+
response = await client.get("https://api.vidu.studio/credit/v1/credits/me")
|
159
|
+
logger.debug(response.status_code)
|
160
|
+
logger.debug(response.text)
|
161
|
+
|
162
|
+
if response.is_success:
|
163
|
+
data = response.json()
|
164
|
+
# {
|
165
|
+
# "credits": 1952,
|
166
|
+
# "credits_expire_today": 0,
|
167
|
+
# "credits_expire_monthly": 1936,
|
168
|
+
# "credits_permanent": 16
|
169
|
+
# }
|
170
|
+
return data
|
171
|
+
response.raise_for_status()
|
172
|
+
|
173
|
+
|
174
|
+
async def check_token(token, threshold: float = 0):
|
175
|
+
try:
|
176
|
+
data = await get_credits(token)
|
177
|
+
logger.debug(data['credits'])
|
178
|
+
return data['credits'] > threshold # 视频
|
179
|
+
except Exception as e:
|
180
|
+
logger.error(e)
|
181
|
+
logger.debug(token)
|
182
|
+
return False
|
183
|
+
|
184
|
+
|
185
|
+
if __name__ == '__main__':
|
186
|
+
token = "sajssdk_2015_cross_new_user=1; _ga=GA1.1.338141957.1727086892; Shunt=; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjgzODMxMDYsImlhdCI6MTcyNzA4NzEwNiwiaXNzIjoiaWFtIiwic3ViIjoiMjQxNjY4MjA0OTYxNDUwNCJ9.Av3Uz9wG0L9ENvClhC9repoRthUm8wgspT5pWcmqaqs; _ga_ZJBV7VYP55=GS1.1.1727086892.1.1.1727087109.0.0.0; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSEnntsASGnESHAS%22%2C%22gae28_aV%22%3A%22EGsErnnGsGuGiH-AtVyGiIuniVIEg-snAAEEHE-EIsREAS-EGsErnnGsGyuyy%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24ki8r28_ergreere%22%3A%22%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlcwZKsQqlcpZ3HPFK8wXzlPhkzws3sPZNhwZP8wqPMwX1JQF18wFwcQh1MQvAJpF3JWFPspF3HPsxqPc323a7OW9dbV9kArdG2usVOukGOWv3n3q3AwFPspX3MQXlswFNEwXNagN%3D%3D%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSEnntsASGnESHAS%22%7D%7D"
|
187
|
+
# FEISHU_URL = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=Hcr2i8"
|
188
|
+
# arun(get_next_token_for_polling(FEISHU_URL, check_token=check_token))
|
189
|
+
# arun(get_next_token_for_polling(FEISHU_URL_VIP, check_token=check_token, max_size=10000))
|
190
|
+
|
191
|
+
# token = "_GRECAPTCHA=09AEXsBHm3ZGyFm6bsaF_HVQw8tBthjXeptYzdw7mGCczOlla0LlYHSb_HESN_xn3uXXR55VaHqXzc8EN2-0eCjQs; io=cmL_418SiY874dz6Ac4C; HMACCOUNT_BFESS=3B0B5E02E41153CB; Hm_lvt_a3c8711bce1795293b1793d35916c067=1725242991; Hm_lpvt_a3c8711bce1795293b1793d35916c067=1725242991; HMACCOUNT=3B0B5E02E41153CB; _ga=GA1.1.793646133.1725242994; sajssdk_2015_cross_new_user=1; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjY1MzkwMDAsImlhdCI6MTcyNTI0MzAwMCwiaXNzIjoiaWFtIiwic3ViIjoiMjQxNTEwMzE4NzgwNTkzMSJ9.AW77pOYME2EePiEV4TmtViBWPvPw_2tiY73R5s2APe8; Shunt=; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSEHEAIEtRtAHGIE%22%2C%22gae28_aV%22%3A%22EGEuARrrVIArig-AgnEgGiVVIyAyit-EuHsHnIR-GsEnAA-EGEuARrrVIEERSE%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24ki8r28_ergreere%22%3A%22%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlJPq0IWZdlwhLkPZP8w9PswZPHPZ7lwswMPs1SBFTaQF3EQqwIBFlcwFPMwvAJpFTawXVkWZNhwF1IQX1aBv3liZ7ku67OV5kgu9G6iZHgiZNapa3cQX1EwF0hwFfIpX0EpFwJ36A%3D%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSEHEAIEtRtAHGIE%22%7D%7D; SERVERCORSID=75eeb9319017a9014e79152a283d6cbe|1725243001|1725242994; _ga_ZJBV7VYP55=GS1.1.1725242993.1.1.1725243001.0.0.0"
|
192
|
+
#
|
193
|
+
# token = '_GRECAPTCHA=09AA5Y-DKEaPCPtfl_s0o9z-HKEP5Tkfrn7CsmZfUj5MUYAFZiW7ELincbr2c2baFkM5Vu_KDPJ11l_N_DJhHTx_A; HMACCOUNT_BFESS=4189E6AE98589913; Hm_lvt_a3c8711bce1795293b1793d35916c067=1722407159; Hm_lpvt_a3c8711bce1795293b1793d35916c067=1722407159; HMACCOUNT=4189E6AE98589913; io=FKh7a-dvlK-UnBmOAB7M; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjM3MDMxNjgsImlhdCI6MTcyMjQwNzE2OCwiaXNzIjoiaWFtIiwic3ViIjoiMjM2ODY0MDkxNDEwMTMxOCJ9.mbNkzI6piihIVDsGSshSCiLlakAAG_Hxh0xAnPkx_vs; Shunt=; Hm_lvt_a3c8711bce1795293b1793d35916c067=1753943158594|1722407159; shortid=parsvjrji; debug=undefined; _grecaptcha=09AA5Y-DJauC2Mo_KPc5_R5OUPR__wsqLYpOjUViIajU8hpDPOpg6LcH1xECbelcZwXl_BSHnZlCWRGxGWvRvMyQr7QGnCCJam75DKvw; VIDU_SELECTED_LOCALE=zh; VIDU_TOUR="v1"'
|
194
|
+
# token = "JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjM3MDIyNjAsImlhdCI6MTcyMjQwNjI2MCwiaXNzIjoiaWFtIiwic3ViIjoiMjM2ODYyNjA0MzE4MTg1NCJ9.8P8WuktyjFM0utFbGcxLQptzfv43ugmMcE31RXR9JJQ"
|
195
|
+
file = Path('/Users/betterme/PycharmProjects/AI/cover.jpeg').read_bytes()
|
196
|
+
url = arun(upload(file, vip=True)).url
|
197
|
+
|
198
|
+
# print(arun(get_next_token_for_polling(FEISHU_URL)) == token)
|
199
|
+
|
200
|
+
# arun(get_task("vidu-2368380300283813", token=token))
|
201
|
+
# arun(get_task('vidu-2389570992698888', token=token))
|
202
|
+
|
203
|
+
# arun(create_task_upscale())
|
204
|
+
|
205
|
+
# token="_ga=GA1.1.2058758439.1724312077; Shunt=; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mjk5MTIxNDcsImlhdCI6MTcyODYxNjE0NywiaXNzIjoiaWFtIiwic3ViIjoiMjQyNzk2NjczODQwNjY3OSJ9.VFLEBmnL8_Biy_46X19Fr5PkbwxdLXx3Xq2GagsW2Fw; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSsRGnnRItSAnnRG%22%2C%22gae28_aV%22%3A%22EGEuAnststSEirt-ARSAigSVHIiHVs-EtHsHnIR-sARInAA-EGEuAnststHsIti%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E8%87%AA%E7%84%B6%E6%90%9C%E7%B4%A2%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%2C%22%24ki8r28_ergreere%22%3A%22z88O2%3A%2F%2Fiyymb682.fmmfkr.ymo%2F%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlJPq0swqfcpXNJPZKSBF0IQXLzWq7lQFQzQZNcBF1SQF3EQqwIBF3MQhwswX08wFlJPq0swqfcpXKcwhzz3aMax9klWZHAiD7HDsJCWskbDskl3qmawqNcQhlsQqyhpXNMQqPIp4xG%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSsRGnnRItSAnnRG%22%7D%7D; _ga_ZJBV7VYP55=GS1.1.1728614362.54.1.1728616189.0.0.0"
|
206
|
+
# arun(get_credits(token))
|
207
|
+
#
|
208
|
+
d = {
|
209
|
+
"model": 'vidu-1.5',
|
210
|
+
"prompt": "这个女人笑起来",
|
211
|
+
"url": "https://oss.ffire.cc/files/kling_watermark.png" # failed to save uploads
|
212
|
+
}
|
213
|
+
token = None
|
214
|
+
# print(bjson(ViduRequest(**d).payload))
|
215
|
+
# arun(create_task(ViduRequest(**d)))
|
216
|
+
# arun(create_task(ViduRequest(**d), vip=False))
|
217
|
+
# # pass
|
218
|
+
# token = "sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSsAAnHAInAGEtIG%22%2C%22gae28_aV%22%3A%22EGEuAnststSEirt-ARSAigSVHIiHVs-EtHsHnIR-sARInAA-EGEuAnststHsIti%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24ki8r28_ergreere%22%3A%22%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlJPq0swqfcpXNJPZKSBF0IQXLzWq7lQFQzQZNcBF1SQF3EQqwIBF3MQhwswX08wFlJPq0swqfcpXKcwhzz3aMax9klWZHAiD7HDsJCWskbDskl3qmawqNcwX0sQF0hQq0HwFfhp4xG%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSsAAnHAInAGEtIG%22%7D%7D;_ga=GA1.1.2058758439.1724312077;_ga_ZJBV7VYP55=GS1.1.1727080335.38.1.1727080510.0.0.0;JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjgzNTAzODAsImlhdCI6MTcyNzA1NDM4MCwiaXNzIjoiaWFtIiwic3ViIjoiMjQyMDA2NTAzNjA5MTgzOSJ9.PkjQqjYB56vYetYwmlagnWn_6bSCwoxCjI7BjfelBOU;Shunt="
|
219
|
+
# # token = "_ga=GA1.1.2058758439.1724312077; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjgzNTAzODAsImlhdCI6MTcyNzA1NDM4MCwiaXNzIjoiaWFtIiwic3ViIjoiMjQyMDA2NTAzNjA5MTgzOSJ9.PkjQqjYB56vYetYwmlagnWn_6bSCwoxCjI7BjfelBOU; Shunt=; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSsAAnHAInAGEtIG%22%2C%22gae28_aV%22%3A%22EGEuAnststSEirt-ARSAigSVHIiHVs-EtHsHnIR-sARInAA-EGEuAnststHsIti%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24ki8r28_ergreere%22%3A%22%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlJPq0swqfcpXNJPZKSBF0IQXLzWq7lQFQzQZNcBF1SQF3EQqwIBF3MQhwswX08wFlJPq0swqfcpXKcwhzz3aMax9klWZHAiD7HDsJCWskbDskl3qmawqNcwX0sQF0hQq0HwFfhp4xG%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSsAAnHAInAGEtIG%22%7D%7D; _ga_ZJBV7VYP55=GS1.1.1727080335.38.1.1727080510.0.0.0"
|
220
|
+
# token = "JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjgzNDkyNzQsImlhdCI6MTcyNzA1MzI3NCwiaXNzIjoiaWFtIiwic3ViIjoiMjQyMDg5NjA4MTIwNTkwNyJ9.MRXmSr48PifQgRN1-yTTu8d7Sq1An4OS7G5WoYpJ_PU"
|
221
|
+
|
222
|
+
# token = "_ga=GA1.1.1191408146.1725443726; Shunt=; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzY0NzgzODIsImlhdCI6MTczNTE4MjM4MiwiaXNzIjoiaWFtIiwic3ViIjoiMjU3NTg1MzI5MDUyNzYwNiJ9.AJBuQH0B9aQ2znnczYoqBw9YvHkLh0uZF0QQx5xdxrc; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sHRHtHIsGAHsRnAn%22%2C%22gae28_aV%22%3A%22EGEuyRHVigIEtAG-AGRuSsHrVAGRuS-EtHsHnIR-sARInAA-EGEuyRHVigSEuIR%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E8%87%AA%E7%84%B6%E6%90%9C%E7%B4%A2%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC%22%2C%22%24ki8r28_ergreere%22%3A%22z88O2%3A%2F%2Fiyymb682.fmmfkr.ymo%2F%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlJPowIQZ7zWqwJpX0HBF0HQs3AwqdkWX0HQs3ABF1SQF3EQqwIBF3MQhwswX08wFlJPowIQZ7zWqNJPqwI3aMax9klWZHAiD7HDsJCWskbDskl3qmawqKIQFfEwh3HwXKcQhPMQaxG%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sHRHtHIsGAHsRnAn%22%7D%7D; _ga_ZJBV7VYP55=GS1.1.1735182278.4.1.1735182405.26.0.0"
|
223
|
+
# arun(check_token(token))
|
224
|
+
#
|
225
|
+
# FEISHU_URL = "https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=rxldsA"
|
226
|
+
# FEISHU_URL="https://xchatllm.feishu.cn/sheets/GYCHsvI4qhnDPNtI4VPcdw2knEd?sheet=Hcr2i8"
|
227
|
+
# api_keys = get_spreadsheet_values(feishu_url=FEISHU_URL, to_dataframe=True)[0]
|
228
|
+
#
|
229
|
+
#
|
230
|
+
# for i in tqdm(api_keys):
|
231
|
+
# logger.debug(i)
|
232
|
+
# if i and arun(check_token(i)):
|
233
|
+
# j = i
|
234
|
+
# # for j in (i or '').split(';'):
|
235
|
+
# # if j.startswith('JWT='):
|
236
|
+
# with open('xx.txt', 'a') as f:
|
237
|
+
# f.write(j + '\n')
|
238
|
+
# #
|
239
|
+
# FEISHU_URL_VIP
|
240
|
+
# arun(get_next_token_for_polling(FEISHU_URL_VIP,
|
241
|
+
# check_token=check_token,
|
242
|
+
# from_redis=True))
|
243
|
+
|
244
|
+
# arun(get_next_token_for_polling(FEISHU_URL,
|
245
|
+
# check_token=check_token,
|
246
|
+
# from_redis=True))
|
247
|
+
|
248
|
+
# from meutils.db.redis_db import redis_aclient
|
249
|
+
|
250
|
+
# arun(redis_aclient.delete(FEISHU_URL))
|
251
|
+
|
252
|
+
# token = "_ga=GA1.1.633410699.1728736789; Shunt=; sensorsdata2015jssdkcross=dfm-enc-%7B%22Va28a6y8_aV%22%3A%22sSRAsSHEntRnsHns%22%2C%22gae28_aV%22%3A%22EGstAuVggRArIr-AtnSIGARtIVIrSt-EnHsHnIR-EEtRAHn-EGstAuVggRErEt%22%2C%22OemO2%22%3A%7B%22%24ki8r28_8eiggay_2mbeyr_8cOr%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24ki8r28_2rieyz_lrcMmeV%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24ki8r28_ergreere%22%3A%22%22%7D%2C%22aVr68a8ar2%22%3A%22rc3liZ7ku67OV5kgPsGCiskkDskl3qmawFlcpXLaW9WoQhLkwsK8wXfsQXwHwXySwsNhWFNSBF1sQF3EQqwIBF1JpXyMQFP8wFlcpXLaW9WoQhTkwFfaBv3liZ7ku67OV5kgu9G6iZHgiZNapa3cQXyMwqNEwFPSQhPcQFPc36A%3D%22%2C%22za28mec_kmfa6_aV%22%3A%7B%226ior%22%3A%22%24aVr68a8c_kmfa6_aV%22%2C%22Cikbr%22%3A%22sSRAsSHEntRnsHns%22%7D%7D; JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzIwMDM4NzAsImlhdCI6MTczMDcwNzg3MCwiaXNzIjoiaWFtIiwic3ViIjoiMjQ3MDI0NTE2ODc2MjU2MiJ9.uK3-CHB_6th4hha_IMI56KT7OLfwq8m-rOJCjwo0sxM; _ga_ZJBV7VYP55=GS1.1.1730707682.2.1.1730707881.0.0.0"
|
253
|
+
#
|
254
|
+
# arun(check_token(token))
|
meutils/apis/vidu/x.py
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : x
|
5
|
+
# @Time : 2024/9/25 10:42
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
|
11
|
+
from meutils.pipe import *
|
12
|
+
from meutils.hash_utils import md5
|
13
|
+
|
14
|
+
# md5("8daf5c4765c493e2")
|
@@ -0,0 +1,236 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : __init__.py
|
5
|
+
# @Time : 2024/7/5 12:05
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description : todo
|
10
|
+
# https://docs.fish.audio/api-reference/endpoint/openapi-v1/speech-to-text
|
11
|
+
# https://docs.fish.audio/text-to-speech/create-model
|
12
|
+
import httpx
|
13
|
+
|
14
|
+
from meutils.pipe import *
|
15
|
+
from meutils.schemas.task_types import Task
|
16
|
+
from meutils.schemas.openai_types import TTSRequest
|
17
|
+
from meutils.config_utils.lark_utils import get_next_token_for_polling
|
18
|
+
from meutils.notice.feishu import send_message as _send_message
|
19
|
+
|
20
|
+
from openai.types.file_object import FileObject
|
21
|
+
from fastapi import UploadFile
|
22
|
+
|
23
|
+
BASE_URL = "https://api.fish.audio"
|
24
|
+
FEISHU_URL = "https://xchatllm.feishu.cn/sheets/ZUyLsVyjMhtexRt3IB9ci9fUnWc?sheet=7ce4e3"
|
25
|
+
|
26
|
+
url = "https://api.fish.audio/model"
|
27
|
+
|
28
|
+
send_message = partial(
|
29
|
+
_send_message,
|
30
|
+
title=__name__,
|
31
|
+
url="https://open.feishu.cn/open-apis/bot/v2/hook/f0475882-ad39-49d9-ad77-523c0e768e96"
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
async def check_token(token: str, for_api: bool = False):
|
36
|
+
path = "api-credit" if for_api else "package"
|
37
|
+
try:
|
38
|
+
headers = {
|
39
|
+
"Authorization": f"Bearer {token}"
|
40
|
+
}
|
41
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers) as client:
|
42
|
+
response = await client.get(f"/wallet/self/{path}")
|
43
|
+
response.raise_for_status()
|
44
|
+
data = response.json()
|
45
|
+
|
46
|
+
# logger.debug(data)
|
47
|
+
|
48
|
+
credit = data.get('credit') or data.get('balance', 0)
|
49
|
+
logger.info(credit)
|
50
|
+
|
51
|
+
return float(credit) > 0
|
52
|
+
except Exception as e:
|
53
|
+
logger.error(e)
|
54
|
+
return False
|
55
|
+
|
56
|
+
|
57
|
+
async def get_model_list(token, **kwargs): # 上传的音色
|
58
|
+
params = {
|
59
|
+
'self': True,
|
60
|
+
'title': None,
|
61
|
+
|
62
|
+
'page_size': 10,
|
63
|
+
'page_number': 1,
|
64
|
+
**kwargs
|
65
|
+
}
|
66
|
+
headers = {
|
67
|
+
"authorization": f"Bearer {token}"
|
68
|
+
}
|
69
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers) as client:
|
70
|
+
response = await client.get("/model", params=params)
|
71
|
+
return response.is_success and response.json()
|
72
|
+
|
73
|
+
|
74
|
+
async def create_task(request: TTSRequest):
|
75
|
+
"""
|
76
|
+
await create_task(request, stream=True)
|
77
|
+
:param request:
|
78
|
+
:return:
|
79
|
+
"""
|
80
|
+
token = await get_next_token_for_polling(feishu_url=FEISHU_URL)
|
81
|
+
|
82
|
+
headers = {
|
83
|
+
"authorization": f"Bearer {token}"
|
84
|
+
}
|
85
|
+
payload = {
|
86
|
+
"type": "tts",
|
87
|
+
"channel": "free",
|
88
|
+
"stream": True, # 区别?
|
89
|
+
"model": request.voice,
|
90
|
+
"parameters": {
|
91
|
+
"text": request.input
|
92
|
+
}
|
93
|
+
}
|
94
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=100) as client:
|
95
|
+
response = await client.post("/task", json=payload)
|
96
|
+
if response.is_success:
|
97
|
+
logger.debug(response.headers)
|
98
|
+
|
99
|
+
task_id = response.headers.get("task-id")
|
100
|
+
task_response = await client.get(f"/task/{task_id}")
|
101
|
+
data = task_response.json()
|
102
|
+
data['url'] = data['result']
|
103
|
+
data['fileview'] = url2fileview(data['result'])
|
104
|
+
return data
|
105
|
+
|
106
|
+
response.raise_for_status()
|
107
|
+
|
108
|
+
|
109
|
+
async def create_file_for_openai(file: UploadFile): # todo: 存储 redis
|
110
|
+
token = await get_next_token_for_polling(feishu_url=FEISHU_URL)
|
111
|
+
|
112
|
+
filename = file.filename or file.file.name
|
113
|
+
model_info = await create_tts_model(token, file=(filename, file.file))
|
114
|
+
|
115
|
+
if isinstance(model_info, dict):
|
116
|
+
model_id = model_info.get("_id")
|
117
|
+
file_id = model_id
|
118
|
+
status = "processed"
|
119
|
+
else:
|
120
|
+
file_id = shortuuid.random()
|
121
|
+
status = "error"
|
122
|
+
|
123
|
+
file_object = FileObject.construct(
|
124
|
+
id=file_id,
|
125
|
+
|
126
|
+
filename=filename, # result.get("file_name")
|
127
|
+
bytes=file.size,
|
128
|
+
|
129
|
+
created_at=int(time.time()),
|
130
|
+
object='file',
|
131
|
+
|
132
|
+
purpose="voice-clone",
|
133
|
+
status=status,
|
134
|
+
|
135
|
+
data=model_info
|
136
|
+
)
|
137
|
+
return file_object
|
138
|
+
|
139
|
+
|
140
|
+
async def create_tts_model(token, file, **kwargs):
|
141
|
+
"""
|
142
|
+
{'_id': '9d10cdbea3954aa9b8fd992fd24b92a7',
|
143
|
+
'author': {'_id': 'd71d7c63c52e4d70be72e3afdb7952ab',
|
144
|
+
'avatar': '',
|
145
|
+
'nickname': '313303303'},
|
146
|
+
'cover_image': 'coverimage/9d10cdbea3954aa9b8fd992fd24b92a7',
|
147
|
+
'created_at': '2024-07-05T05:30:32.020433Z',
|
148
|
+
'description': '',
|
149
|
+
'languages': ['zh'],
|
150
|
+
'like_count': 0,
|
151
|
+
'liked': False,
|
152
|
+
'mark_count': 0,
|
153
|
+
'marked': False,
|
154
|
+
'samples_text': [],
|
155
|
+
'shared_count': 0,
|
156
|
+
'state': 'trained',
|
157
|
+
'tags': [],
|
158
|
+
'task_count': 0,
|
159
|
+
'title': 'chatfire',
|
160
|
+
'train_mode': 'fast',
|
161
|
+
'type': 'tts',
|
162
|
+
'updated_at': '2024-07-05T05:30:32.020407Z',
|
163
|
+
'visibility': 'public'}
|
164
|
+
"""
|
165
|
+
payload = {
|
166
|
+
**kwargs
|
167
|
+
}
|
168
|
+
|
169
|
+
logger.debug(file)
|
170
|
+
|
171
|
+
files = {
|
172
|
+
'title': (None, 'chatfire-tts'),
|
173
|
+
'description': (None, ''),
|
174
|
+
'type': (None, 'tts'),
|
175
|
+
'train_mode': (None, 'fast'),
|
176
|
+
'visibility': (None, 'public'), # private
|
177
|
+
|
178
|
+
'voices': file, # ('audio_name.mp3', file)
|
179
|
+
'cover_image': open(get_resolve_path('cowboy-hat-face.webp', __file__), 'rb')
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
headers = {
|
184
|
+
"authorization": f"Bearer {token}"
|
185
|
+
}
|
186
|
+
async with httpx.AsyncClient(base_url=BASE_URL, headers=headers, timeout=100) as client:
|
187
|
+
response = await client.post("/model", json=payload, files=files)
|
188
|
+
# logger.debug(response.text)
|
189
|
+
if response.is_success:
|
190
|
+
_ = response.json()
|
191
|
+
_['model_id'] = _['_id']
|
192
|
+
return _
|
193
|
+
else:
|
194
|
+
return response.text
|
195
|
+
|
196
|
+
|
197
|
+
if __name__ == '__main__':
|
198
|
+
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZDcxZDdjNjNjNTJlNGQ3MGJlNzJlM2FmZGI3OTUyYWIiLCJleHAiOjE3MzAyODYwNjguNTMyMTA5NX0.GNeW2WLlBqyP6evNQFkXpqa0UYOg50_IwNO48DuJc04"
|
199
|
+
# print(bjson(arun(get_model_list(token))))
|
200
|
+
# file = open('/Users/betterme/Downloads/whisper-1719913495729-54f08dde5.wav.mp3.mp3', 'rb')
|
201
|
+
|
202
|
+
# arun(get_model_list(token))
|
203
|
+
# file = UploadFile(file)
|
204
|
+
# pprint(arun(create_tts_model(token, file=(file.file.name, file.file))))
|
205
|
+
# model = "9d10cdbea3954aa9b8fd992fd24b92a7"
|
206
|
+
# # # task_id = "f5a94a3fb78646b8ab1c3606413ca9e0"
|
207
|
+
# with timer():
|
208
|
+
# text = "文本转语音\n文本转语音\n文本转语音\n文本转语音\n"
|
209
|
+
# request = TTSRequest(input=text, model=model)
|
210
|
+
# arun(create_task(request))
|
211
|
+
# open("xx.mp3", 'wb').write(f)
|
212
|
+
|
213
|
+
# async def main():
|
214
|
+
# content = await create_task(request, stream=True)
|
215
|
+
# with open("xx.mp3", 'wb') as f:
|
216
|
+
# f.write(content)
|
217
|
+
|
218
|
+
# arun(main())
|
219
|
+
|
220
|
+
# pprint(arun(get_tts_task(token, task_id)))
|
221
|
+
|
222
|
+
#
|
223
|
+
# file = open('/Users/betterme/Downloads/whisper-1719913495729-54f08dde5.wav.mp3.mp3', 'rb')
|
224
|
+
#
|
225
|
+
# file = UploadFile(file)
|
226
|
+
#
|
227
|
+
# print(arun(upload_audio_for_tts_model(file=file)))
|
228
|
+
|
229
|
+
# token = "5cf445234491429c9855d3fa666d49f6"
|
230
|
+
|
231
|
+
# arun(check_token(token, for_api=True))
|
232
|
+
|
233
|
+
# text = "文本转语音\n文本转语音\n文本转语音\n文本转语音\n"
|
234
|
+
|
235
|
+
|
236
|
+
arun(create_task(TTSRequest(input="你好", model="")))
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : fish_api
|
5
|
+
# @Time : 2024/10/17 09:54
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
from meutils.pipe import *
|
14
|
+
from fish_audio_sdk import Session
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : web_search
|
5
|
+
# @Time : 2024/5/10 11:17
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
import langchain
|
11
|
+
from meutils.pipe import *
|
12
|
+
import urllib, json
|
13
|
+
|
14
|
+
def results(original_query):
|
15
|
+
search_specs = [
|
16
|
+
["Google", "~googlequery", "https://www.google.com/search?q="],
|
17
|
+
["Duck Duck Go", "~duckduckgoquery", "https://duckduckgo.com/?q="],
|
18
|
+
["Google Images", "~googleimagequery", "https://www.google.com/search?tbm=isch&q="],
|
19
|
+
["Baidu", "~baiduquery", "http://www.baidu.com/s?wd="],
|
20
|
+
["Bing", "~bingquery", "http://www.bing.com/search?q="],
|
21
|
+
["Yahoo", "~yahooquery", "https://sg.search.yahoo.com/search?p="],
|
22
|
+
["Twitter", "~twitterquery", "https://mobile.twitter.com/search?q="],
|
23
|
+
["Reddit", "~redditquery", "https://www.reddit.com/search?q="]
|
24
|
+
]
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
if __name__ == '__main__':
|
31
|
+
results(original_query="周杰伦")
|
meutils/apis/yezi.py
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : yezi
|
5
|
+
# @Time : 2024/6/28 09:23
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# todo: 接码平台
|
10
|
+
# @Description : https://github.com/Thekers/Get_OpenaiKey/blob/9d174669d7778ea32d1132bedd5167597912dcfb/Add_01AI_Token.py
|
11
|
+
# https://note.youdao.com/ynoteshare/index.html?id=543e0ee9d51faf3d4c33d792971d9de9&type=note&_time=1719535893843
|
12
|
+
import os
|
13
|
+
|
14
|
+
import httpx
|
15
|
+
|
16
|
+
from meutils.pipe import *
|
17
|
+
|
18
|
+
"http://api.sqhyw.net:90/api/get_myinfo?token=xxxxxxx"
|
19
|
+
|
20
|
+
BASE_URL = "http://api.sqhyw.net:90"
|
21
|
+
|
22
|
+
|
23
|
+
class Request(BaseModel):
|
24
|
+
token: str
|
25
|
+
project_id: str
|
26
|
+
loop: str = 1
|
27
|
+
operator: str = 4 # 0=默认 1=移动 2=联通 3=电信 4=实卡 5=虚卡
|
28
|
+
phone_num: Optional[str] = None # 指定取号的话 这里填要取的手机号
|
29
|
+
scope: Optional[str] = None # 指定号段 最多支持号码前5位. 例如可以为165,也可以为16511address
|
30
|
+
address: Optional[str] = None # 归属地选择 例如 湖北 甘肃 不需要带省字
|
31
|
+
scope_black: Optional[str] = None # 排除号段最长支持7位且可以支持多个,最多支持20个号段。用逗号分隔 比如150,1511111,15522
|
32
|
+
api_id: Optional[str] = None # 如果是开发者,此处填写你的用户ID才有收益,注意是用户ID不是登录账号
|
33
|
+
|
34
|
+
|
35
|
+
@alru_cache()
|
36
|
+
async def get_access_token():
|
37
|
+
username, password = os.getenv("YEZI_USER").split('|')
|
38
|
+
payload = {
|
39
|
+
"username": username,
|
40
|
+
"password": password
|
41
|
+
}
|
42
|
+
async with httpx.AsyncClient(base_url=BASE_URL) as client:
|
43
|
+
response = await client.get("/api/logins", params=payload)
|
44
|
+
if response.is_success:
|
45
|
+
logger.debug(response.json())
|
46
|
+
return response.json().get("token")
|
47
|
+
|
48
|
+
|
49
|
+
async def get_mobile(project_id: str = "806053"):
|
50
|
+
token = await get_access_token()
|
51
|
+
payload = Request(token=token, project_id=project_id).model_dump()
|
52
|
+
|
53
|
+
async with httpx.AsyncClient(base_url=BASE_URL) as client:
|
54
|
+
response = await client.get("/api/get_mobile", params=payload)
|
55
|
+
if response.is_success:
|
56
|
+
logger.debug(response.json())
|
57
|
+
return response.json().get("mobile")
|
58
|
+
|
59
|
+
|
60
|
+
async def get_message(project_id, phone_num):
|
61
|
+
token = await get_access_token()
|
62
|
+
payload = Request(token=token, project_id=project_id, phone_num=phone_num).model_dump()
|
63
|
+
|
64
|
+
async with httpx.AsyncClient(base_url=BASE_URL) as client:
|
65
|
+
s = time.time()
|
66
|
+
while 1:
|
67
|
+
await asyncio.sleep(1)
|
68
|
+
response = await client.get("/api/get_message", params=payload)
|
69
|
+
if response.is_success and (code := response.json().get("code")):
|
70
|
+
logger.debug(response.json())
|
71
|
+
return code
|
72
|
+
if time.time() - s > 120:
|
73
|
+
logger.error("获取短信验证码失败")
|
74
|
+
break
|
75
|
+
|
76
|
+
|
77
|
+
async def free_mobile(project_id, phone_num: Optional[str] = None): # 释放所有
|
78
|
+
token = await get_access_token()
|
79
|
+
payload = Request(token=token, project_id=project_id, phone_num=phone_num).model_dump()
|
80
|
+
|
81
|
+
async with httpx.AsyncClient(base_url=BASE_URL) as client:
|
82
|
+
response = await client.get("/api/free_mobile", params=payload)
|
83
|
+
if response.is_success:
|
84
|
+
logger.debug("释放")
|
85
|
+
|
86
|
+
|
87
|
+
async def get_code(project_id):
|
88
|
+
phone_num = await get_mobile(project_id)
|
89
|
+
code = await get_message(project_id, phone_num)
|
90
|
+
await free_mobile(project_id, phone_num)
|
91
|
+
return code
|
92
|
+
|
93
|
+
|
94
|
+
if __name__ == '__main__':
|
95
|
+
# print(arun(get_access_token()))
|
96
|
+
# print(arun(get_mobile()))
|
97
|
+
print(arun(get_message(project_id="806053", phone_num="19211569315")))
|