diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..dab9a4e17afd2ef39d90ccb0b40ef2786fe77422 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,35 @@ -*.7z filter=lfs diff=lfs merge=lfs -text -*.arrow filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.ckpt filter=lfs diff=lfs merge=lfs -text -*.ftz filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.h5 filter=lfs diff=lfs merge=lfs -text -*.joblib filter=lfs diff=lfs merge=lfs -text -*.lfs.* filter=lfs diff=lfs merge=lfs -text -*.mlmodel filter=lfs diff=lfs merge=lfs -text -*.model filter=lfs diff=lfs merge=lfs -text -*.msgpack filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text -*.npz filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text -*.ot filter=lfs diff=lfs merge=lfs -text -*.parquet filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.pickle filter=lfs diff=lfs merge=lfs -text -*.pkl filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.pth filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.safetensors filter=lfs diff=lfs merge=lfs -text -saved_model/**/* filter=lfs diff=lfs merge=lfs -text -*.tar.* filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tflite filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.wasm filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.zst filter=lfs diff=lfs merge=lfs -text -*tfevents* filter=lfs diff=lfs merge=lfs -text +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..51e9d59e6732acf9330276920d77460367fd654a --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..29f81d812f3e768fa89638d1f72920dbfd1413a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 4f06bc6781b48fe73de02521a0064ed2d80f71a6..082ef4b6373e6106ddbd927b8a429ebf07bbc8c7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,59 @@ ---- -title: InfomericaTryV1 -emoji: 🚀 -colorFrom: pink -colorTo: green -sdk: gradio -sdk_version: 4.37.1 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +# outfit-anyone +[English](https://github.com/ihmily/outfit-anyone/blob/main/README.md) | [简体中文](https://github.com/ihmily/outfit-anyone/blob/main/README_CN.md) + +Outfit Anyone (Latest Fixed Version): Ultra-high quality virtual try-on for Any Clothing and Any Person + +This project is actually a client that calls the interface. The model is not actually open source, models are fixed and cannot be uploaded or modified. Outfit Anyone only support users uploading their own garments. + +## How to Run + +**Test Environment: Python 3.10(No computational power required)** + +Pull or download the code + +``` +git clone https://github.com/ihmily/outfit-anyone.git +``` + +Install dependencies + +``` +cd outfit-anyone +pip install -r requirements.txt +``` + +~~**Set up the environment variable**~~ + +``` + +``` + +Run + +``` +python app.py +``` + +Success log + +``` +Loaded as API: https://humanaigc-outfitanyone.hf.space ✔ +Running on local URL: http://127.0.0.1:6006 +``` + +Please visit http://127.0.0.1:6006 to web. + +Visit [OutfitAnyone - a Hugging Face Space by HumanAIGC](https://huggingface.co/spaces/HumanAIGC/OutfitAnyone) Learn more. + +## View Results + +![screenshot_image](./images/Snipaste_2024-04-18_19-06-02.jpg) + + + +![screenshot_image](./images/Snipaste_2024-04-18_19-13-52.jpg) + + + +![screenshot_image](./images/Snipaste_2024-04-18_19-11-35.jpg) + diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000000000000000000000000000000000000..9a3bb6b9d73db14487a6d71b0b2d261d8f60d2fa --- /dev/null +++ b/README_CN.md @@ -0,0 +1,57 @@ +# outfit-anyone +[English](https://github.com/ihmily/outfit-anyone/blob/main/README.md) | [简体中文](https://github.com/ihmily/outfit-anyone/blob/main/README_CN.md) + +Outfit Anyone(最新修复版):适用于任何服装和任何人的超高品质虚拟试穿 + +Outfit Anyone 的模型实际上并未开源,这个项目只是一个调用接口的客户端,模型是固定的,不能上传或修改,只支持用户上传自己的服装,生成图片。 + +## 如何运行 + +**测试环境:** **Python 3.10** + +拉取或下载代码 + +``` +git clone https://github.com/ihmily/outfit-anyone.git +``` + +安装依赖 + +``` +cd outfit-anyone +pip install -r requirements.txt +``` + +~~**设置环境变量(重点)*~~ + +``` + +``` + +运行 + +``` +python app.py +``` + +启动成功后,web服务运行在6006端口。你将看到以下类似信息 + +``` +Loaded as API: https://humanaigc-outfitanyone.hf.space ✔ +Running on local URL: http://127.0.0.1:6006 +``` + +访问 [OutfitAnyone - a Hugging Face Space by HumanAIGC](https://huggingface.co/spaces/HumanAIGC/OutfitAnyone) 了解更多。 + + + +## 演示结果 + +![screenshot_image](./images/Snipaste_2024-04-18_19-06-02.jpg) + +![screenshot_image](./images/Snipaste_2024-04-18_19-13-52.jpg) + +![screenshot_image](./images/Snipaste_2024-04-18_19-11-35.jpg) + + + diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..2366f36adc9c0992cc2175085d0234e51679bc67 --- /dev/null +++ b/app.py @@ -0,0 +1,160 @@ +import os +import cv2 +import random +import gradio as gr +from gradio_client import Client, handle_file + +machine_number = 0 +model = os.path.join(os.path.dirname(__file__), "models/eva/Eva_0.png") +client = Client("HumanAIGC/OutfitAnyone") + +MODEL_MAP = { + "AI Model Rouyan_0": 'models/rouyan_new/Rouyan_0.png', + "AI Model Rouyan_1": 'models/rouyan_new/Rouyan_1.png', + "AI Model Rouyan_2": 'models/rouyan_new/Rouyan_2.png', + "AI Model Eva_0": 'models/eva/Eva_0.png', + "AI Model Eva_1": 'models/eva/Eva_1.png', + "AI Model Simon_0": 'models/simon_online/Simon_0.png', + "AI Model Simon_1": 'models/simon_online/Simon_1.png', + "AI Model Xuanxuan_0": 'models/xiaoxuan_online/Xuanxuan_0.png', + "AI Model Xuanxuan_1": 'models/xiaoxuan_online/Xuanxuan_1.png', + "AI Model Xuanxuan_2": 'models/xiaoxuan_online/Xuanxuan_2.png', + "AI Model Yaqi_0": 'models/yaqi/Yaqi_0.png', + "AI Model Yaqi_1": 'models/yaqi/Yaqi_1.png', + "AI Model Yaqi_2": 'models/yaqi/Yaqi_2.png', + "AI Model Yaqi_3": 'models/yaqi/Yaqi_3.png', + "AI Model Yifeng_0": 'models/yifeng_online/Yifeng_0.png', + "AI Model Yifeng_1": 'models/yifeng_online/Yifeng_1.png', + "AI Model Yifeng_2": 'models/yifeng_online/Yifeng_2.png', + "AI Model Yifeng_3": 'models/yifeng_online/Yifeng_3.png', +} + + +def add_waterprint(img): + h, w, _ = img.shape + img = cv2.putText(img, 'Powered by Infomerica', (int(0.3 * w), h - 20), cv2.FONT_HERSHEY_PLAIN, 2, + (128, 128, 128), 2, cv2.LINE_AA) + + return img + + +def get_tryon_result(model_name, garment1, garment2, seed=1234): + # _model = "AI Model " + model_name.split("\\")[-1].split(".")[0] # windows + _model = "AI Model " + model_name.split("/")[-1].split(".")[0] # linux + print("Use Model:", _model) + seed = random.randint(0, 1222222222) + garment1 = handle_file(garment1) if garment1 else None + garment2 = handle_file(garment2) if garment2 else None + result = client.predict( + handle_file(model_name), + garment1, + garment2, + api_name="/get_tryon_result", + fn_index=seed + ) + final_img = remove_watermark2(result) + return final_img + + +def remove_watermark2(path): + img = cv2.imread(path) + img_ = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) + h, w, _ = img.shape + + y_start = max(h - 45, 0) + y_end = h + x_start = max(int(0.3 * w), 0) + x_end = w + + img_[y_start:y_end, x_start:x_end, :] = [255, 255, 255] + + return img_ + + +with gr.Blocks(css=".output-image, .input-image, .image-preview {height: 400px !important} ") as demo: + # gr.Markdown("# Outfit Anyone v0.9") + gr.HTML( + """ + + + + """) + with gr.Row(): + with gr.Column(): + init_image = gr.Image(sources='clipboard', type="filepath", label="model", value=model) + example = gr.Examples(inputs=init_image, + examples_per_page=4, + examples=[os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Rouyan_0')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Rouyan_2')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Eva_0')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Simon_1')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Eva_1')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Simon_0')), + os.path.join(os.path.dirname(__file__), + MODEL_MAP.get('AI Model Xuanxuan_0')), + os.path.join(os.path.dirname(__file__), + MODEL_MAP.get('AI Model Xuanxuan_2')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Yaqi_1')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Yifeng_0')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Yifeng_3')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Rouyan_1')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Yifeng_2')), + os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Yaqi_0')), + ]) + with gr.Column(): + gr.HTML( + """ + + """) + with gr.Row(): + garment_top = gr.Image(sources='upload', type="filepath", label="top garment") + example_top = gr.Examples(inputs=garment_top, + examples_per_page=5, + examples=[os.path.join(os.path.dirname(__file__), "garments/top222.JPG"), + os.path.join(os.path.dirname(__file__), "garments/top5.png"), + os.path.join(os.path.dirname(__file__), "garments/top333.png"), + os.path.join(os.path.dirname(__file__), "garments/dress1.png"), + os.path.join(os.path.dirname(__file__), "garments/dress2.png"), + ]) + garment_down = gr.Image(sources='upload', type="filepath", label="lower garment") + example_down = gr.Examples(inputs=garment_down, + examples_per_page=5, + examples=[os.path.join(os.path.dirname(__file__), "garments/bottom1.png"), + os.path.join(os.path.dirname(__file__), "garments/bottom2.PNG"), + os.path.join(os.path.dirname(__file__), "garments/bottom3.JPG"), + os.path.join(os.path.dirname(__file__), "garments/bottom4.PNG"), + os.path.join(os.path.dirname(__file__), "garments/bottom5.png"), + ]) + + run_button = gr.Button(value="Run") + with gr.Column(): + gallery = gr.Image() + + run_button.click(fn=get_tryon_result, + inputs=[ + init_image, + garment_top, + garment_down, + ], + outputs=[gallery], + concurrency_limit=2) + + # Examples + gr.Markdown("## Examples") + with gr.Row(): + reference_image1 = gr.Image(label="model", scale=1, value="examples/basemodel.png") + reference_image2 = gr.Image(label="garment", scale=1, value="examples/garment1.jpg") + reference_image3 = gr.Image(label="result", scale=1, value="examples/result1.png") + gr.Examples( + examples=[ + ["examples/basemodel.png", "examples/garment1.png", "examples/result1.png"], + ["examples/basemodel.png", "examples/garment2.png", "examples/result2.png"], + ["examples/basemodel.png", "examples/garment3.png", "examples/result3.png"], + ], + inputs=[reference_image1, reference_image2, reference_image3], + label=None, + ) + +if __name__ == "__main__": + demo.queue(max_size=10) + demo.launch(share=False, server_name='127.0.0.1', server_port=6006) diff --git a/examples/basemodel.png b/examples/basemodel.png new file mode 100644 index 0000000000000000000000000000000000000000..edc56f22be9999ecdc9995d6e3d37550bbc6ad76 Binary files /dev/null and b/examples/basemodel.png differ diff --git a/examples/garment1.jpg b/examples/garment1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0f23f4f4b500802c791a88ba66ed430fa1482fb8 Binary files /dev/null and b/examples/garment1.jpg differ diff --git a/examples/garment1.png b/examples/garment1.png new file mode 100644 index 0000000000000000000000000000000000000000..9d1e6ba4d5a5c90063236c3f669c3a5a6a6d8168 Binary files /dev/null and b/examples/garment1.png differ diff --git a/examples/garment2.jpg b/examples/garment2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..31b41a161f9ddf052f5ec288a9df563eb4818f0a Binary files /dev/null and b/examples/garment2.jpg differ diff --git a/examples/garment2.png b/examples/garment2.png new file mode 100644 index 0000000000000000000000000000000000000000..919d51031ae96a6b30c2ebb3e6301509fc99256b Binary files /dev/null and b/examples/garment2.png differ diff --git a/examples/garment3.png b/examples/garment3.png new file mode 100644 index 0000000000000000000000000000000000000000..f09a7ca18386e9cfcf9b3a3437624064e1e431ab Binary files /dev/null and b/examples/garment3.png differ diff --git a/examples/result1.png b/examples/result1.png new file mode 100644 index 0000000000000000000000000000000000000000..f073f254204da79176a9b751eb65f5e824cabb4d Binary files /dev/null and b/examples/result1.png differ diff --git a/examples/result2.png b/examples/result2.png new file mode 100644 index 0000000000000000000000000000000000000000..29438f50c84e9a5872ef64239bd37ed82142ef87 Binary files /dev/null and b/examples/result2.png differ diff --git a/examples/result3.png b/examples/result3.png new file mode 100644 index 0000000000000000000000000000000000000000..5f543ec45a2e250b2b3493a6b5eaf18cbc7a9cb4 Binary files /dev/null and b/examples/result3.png differ diff --git a/garments/bottom1.png b/garments/bottom1.png new file mode 100644 index 0000000000000000000000000000000000000000..53ed315502710e5f2252ce0cb2b8dbb09db046d4 Binary files /dev/null and b/garments/bottom1.png differ diff --git a/garments/bottom2.PNG b/garments/bottom2.PNG new file mode 100644 index 0000000000000000000000000000000000000000..fc56bc984a54a7ee528c49c7310563a941952367 Binary files /dev/null and b/garments/bottom2.PNG differ diff --git a/garments/bottom3.JPG b/garments/bottom3.JPG new file mode 100644 index 0000000000000000000000000000000000000000..eb5d96846735d549da3c1379e61095437a162613 Binary files /dev/null and b/garments/bottom3.JPG differ diff --git a/garments/bottom4.PNG b/garments/bottom4.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c75e93cccf03377113aefa690d20c17f1b137438 Binary files /dev/null and b/garments/bottom4.PNG differ diff --git a/garments/bottom5.png b/garments/bottom5.png new file mode 100644 index 0000000000000000000000000000000000000000..0e30263d5a238d4f413cff4584a397c7f92db464 Binary files /dev/null and b/garments/bottom5.png differ diff --git a/garments/dress1.png b/garments/dress1.png new file mode 100644 index 0000000000000000000000000000000000000000..a1e6170075f2816fd047e150411450f6a4ec200d Binary files /dev/null and b/garments/dress1.png differ diff --git a/garments/dress2.png b/garments/dress2.png new file mode 100644 index 0000000000000000000000000000000000000000..64fdc508460f835fe6f16e2f06850641a333feca Binary files /dev/null and b/garments/dress2.png differ diff --git a/garments/top111.png b/garments/top111.png new file mode 100644 index 0000000000000000000000000000000000000000..82a4d272252857a3a8d9ce803e785db0844ac8df Binary files /dev/null and b/garments/top111.png differ diff --git a/garments/top222.JPG b/garments/top222.JPG new file mode 100644 index 0000000000000000000000000000000000000000..62f5daafcf14a73d0b75a0a694a0f72c6d83ddd5 Binary files /dev/null and b/garments/top222.JPG differ diff --git a/garments/top3.JPG b/garments/top3.JPG new file mode 100644 index 0000000000000000000000000000000000000000..e0bb63c4cd8e8394368fe652da997f083512fed1 Binary files /dev/null and b/garments/top3.JPG differ diff --git a/garments/top333.png b/garments/top333.png new file mode 100644 index 0000000000000000000000000000000000000000..b6a7e4dff5b96ad7fa300956d415b89dbe25ded3 Binary files /dev/null and b/garments/top333.png differ diff --git a/garments/top4.png b/garments/top4.png new file mode 100644 index 0000000000000000000000000000000000000000..e59993d2c0ba6a237852bf79905f9ba7706868cd Binary files /dev/null and b/garments/top4.png differ diff --git a/garments/top5.png b/garments/top5.png new file mode 100644 index 0000000000000000000000000000000000000000..bb70177453ac621d8431d67137c884dfec39425b Binary files /dev/null and b/garments/top5.png differ diff --git a/images/Snipaste_2024-04-18_19-06-02.jpg b/images/Snipaste_2024-04-18_19-06-02.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a56ec746b8a9fbe1978ec5764e028ee6749c1e2e Binary files /dev/null and b/images/Snipaste_2024-04-18_19-06-02.jpg differ diff --git a/images/Snipaste_2024-04-18_19-11-35.jpg b/images/Snipaste_2024-04-18_19-11-35.jpg new file mode 100644 index 0000000000000000000000000000000000000000..70523abb3ab6c5de5c2b29627bd1734397045d08 Binary files /dev/null and b/images/Snipaste_2024-04-18_19-11-35.jpg differ diff --git a/images/Snipaste_2024-04-18_19-13-52.jpg b/images/Snipaste_2024-04-18_19-13-52.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8f579edb7ac5cd7a15a13252047c056dcf2c37b6 Binary files /dev/null and b/images/Snipaste_2024-04-18_19-13-52.jpg differ diff --git a/models/eva/Eva_0.png b/models/eva/Eva_0.png new file mode 100644 index 0000000000000000000000000000000000000000..8cc93d7384b2fba25d3677d34cd6b4acc0712f89 Binary files /dev/null and b/models/eva/Eva_0.png differ diff --git a/models/eva/Eva_1.png b/models/eva/Eva_1.png new file mode 100644 index 0000000000000000000000000000000000000000..0c235d0ff07a314d705bf91f2a7859b562b464ab Binary files /dev/null and b/models/eva/Eva_1.png differ diff --git a/models/rouyan_new/0/densepose.png b/models/rouyan_new/0/densepose.png new file mode 100644 index 0000000000000000000000000000000000000000..00843077a5005f09a8679fa58a8eac29599a60ab Binary files /dev/null and b/models/rouyan_new/0/densepose.png differ diff --git a/models/rouyan_new/0/humanmask.png b/models/rouyan_new/0/humanmask.png new file mode 100644 index 0000000000000000000000000000000000000000..312c2baa78b90e7edaf1acd88265642768d228c5 Binary files /dev/null and b/models/rouyan_new/0/humanmask.png differ diff --git a/models/rouyan_new/0/initmask.png b/models/rouyan_new/0/initmask.png new file mode 100644 index 0000000000000000000000000000000000000000..fddbf24c957027b603cf5b88b82779a72d192f22 Binary files /dev/null and b/models/rouyan_new/0/initmask.png differ diff --git a/models/rouyan_new/0/model.png b/models/rouyan_new/0/model.png new file mode 100644 index 0000000000000000000000000000000000000000..6371fe113d1db941b0c16b8237aec323291a8955 Binary files /dev/null and b/models/rouyan_new/0/model.png differ diff --git a/models/rouyan_new/1/densepose.png b/models/rouyan_new/1/densepose.png new file mode 100644 index 0000000000000000000000000000000000000000..9dd81ff50719856bf2f6a0faa08de10bc234b3c8 Binary files /dev/null and b/models/rouyan_new/1/densepose.png differ diff --git a/models/rouyan_new/1/humanmask.png b/models/rouyan_new/1/humanmask.png new file mode 100644 index 0000000000000000000000000000000000000000..c079b370e250c45d2d1b395436c69b12b9c94de0 Binary files /dev/null and b/models/rouyan_new/1/humanmask.png differ diff --git a/models/rouyan_new/1/initmask.png b/models/rouyan_new/1/initmask.png new file mode 100644 index 0000000000000000000000000000000000000000..134859ca42fad5082a821899d527fac58a25b28d Binary files /dev/null and b/models/rouyan_new/1/initmask.png differ diff --git a/models/rouyan_new/1/model.png b/models/rouyan_new/1/model.png new file mode 100644 index 0000000000000000000000000000000000000000..cea983e91bd8c189c2d976cb1e2221562549d8c4 Binary files /dev/null and b/models/rouyan_new/1/model.png differ diff --git a/models/rouyan_new/2/densepose.png b/models/rouyan_new/2/densepose.png new file mode 100644 index 0000000000000000000000000000000000000000..fc45ad05662df36776acd4beaa6c1da077779506 Binary files /dev/null and b/models/rouyan_new/2/densepose.png differ diff --git a/models/rouyan_new/2/humanmask.png b/models/rouyan_new/2/humanmask.png new file mode 100644 index 0000000000000000000000000000000000000000..eac4394be9c7d9aad9c567b0a695dd1f2c1cdcb1 Binary files /dev/null and b/models/rouyan_new/2/humanmask.png differ diff --git a/models/rouyan_new/2/initmask.png b/models/rouyan_new/2/initmask.png new file mode 100644 index 0000000000000000000000000000000000000000..ec01a61b670c8f4e04c5be9e153e43eb284fb23a Binary files /dev/null and b/models/rouyan_new/2/initmask.png differ diff --git a/models/rouyan_new/2/model.png b/models/rouyan_new/2/model.png new file mode 100644 index 0000000000000000000000000000000000000000..ddf30201bfcabc71da81c1261fff89a316ede6a5 Binary files /dev/null and b/models/rouyan_new/2/model.png differ diff --git a/models/rouyan_new/Rouyan_0.png b/models/rouyan_new/Rouyan_0.png new file mode 100644 index 0000000000000000000000000000000000000000..6371fe113d1db941b0c16b8237aec323291a8955 Binary files /dev/null and b/models/rouyan_new/Rouyan_0.png differ diff --git a/models/rouyan_new/Rouyan_1.png b/models/rouyan_new/Rouyan_1.png new file mode 100644 index 0000000000000000000000000000000000000000..cea983e91bd8c189c2d976cb1e2221562549d8c4 Binary files /dev/null and b/models/rouyan_new/Rouyan_1.png differ diff --git a/models/rouyan_new/Rouyan_2.png b/models/rouyan_new/Rouyan_2.png new file mode 100644 index 0000000000000000000000000000000000000000..ddf30201bfcabc71da81c1261fff89a316ede6a5 Binary files /dev/null and b/models/rouyan_new/Rouyan_2.png differ diff --git a/models/simon_online/Simon_0.png b/models/simon_online/Simon_0.png new file mode 100644 index 0000000000000000000000000000000000000000..da459bc35de31063da6082d2ec2cd8a9ea6ce83f Binary files /dev/null and b/models/simon_online/Simon_0.png differ diff --git a/models/simon_online/Simon_1.png b/models/simon_online/Simon_1.png new file mode 100644 index 0000000000000000000000000000000000000000..06ee8f72f2f81a90c4b5c7d1dea5f575e445882a Binary files /dev/null and b/models/simon_online/Simon_1.png differ diff --git a/models/xiaoxuan/model.png b/models/xiaoxuan/model.png new file mode 100644 index 0000000000000000000000000000000000000000..c400004bb7af59681a687825f094a5f3fa7ab9ad Binary files /dev/null and b/models/xiaoxuan/model.png differ diff --git a/models/xiaoxuan_online/Xuanxuan_0.png b/models/xiaoxuan_online/Xuanxuan_0.png new file mode 100644 index 0000000000000000000000000000000000000000..c400004bb7af59681a687825f094a5f3fa7ab9ad Binary files /dev/null and b/models/xiaoxuan_online/Xuanxuan_0.png differ diff --git a/models/xiaoxuan_online/Xuanxuan_1.png b/models/xiaoxuan_online/Xuanxuan_1.png new file mode 100644 index 0000000000000000000000000000000000000000..fc791cb9f839610f9cedb28ff9c755e797b7ddc2 Binary files /dev/null and b/models/xiaoxuan_online/Xuanxuan_1.png differ diff --git a/models/xiaoxuan_online/Xuanxuan_2.png b/models/xiaoxuan_online/Xuanxuan_2.png new file mode 100644 index 0000000000000000000000000000000000000000..49e61e56ba4d8523858c3da20eeccec519de93c2 Binary files /dev/null and b/models/xiaoxuan_online/Xuanxuan_2.png differ diff --git a/models/yaqi/Yaqi_0.png b/models/yaqi/Yaqi_0.png new file mode 100644 index 0000000000000000000000000000000000000000..66b7e23458646ac46c7d340a4d21407ab8653991 Binary files /dev/null and b/models/yaqi/Yaqi_0.png differ diff --git a/models/yaqi/Yaqi_1.png b/models/yaqi/Yaqi_1.png new file mode 100644 index 0000000000000000000000000000000000000000..bd9a37dd31be5f3f196b7efc522318945343c0ca Binary files /dev/null and b/models/yaqi/Yaqi_1.png differ diff --git a/models/yifeng/model.png b/models/yifeng/model.png new file mode 100644 index 0000000000000000000000000000000000000000..337a542677a54ec5a7f96a715c87012098c5c56a Binary files /dev/null and b/models/yifeng/model.png differ diff --git a/models/yifeng_online/Yifeng_0.png b/models/yifeng_online/Yifeng_0.png new file mode 100644 index 0000000000000000000000000000000000000000..82791dee68a8963a61679297c57d1c61f1a4403a Binary files /dev/null and b/models/yifeng_online/Yifeng_0.png differ diff --git a/models/yifeng_online/Yifeng_1.png b/models/yifeng_online/Yifeng_1.png new file mode 100644 index 0000000000000000000000000000000000000000..337a542677a54ec5a7f96a715c87012098c5c56a Binary files /dev/null and b/models/yifeng_online/Yifeng_1.png differ diff --git a/models/yifeng_online/Yifeng_2.png b/models/yifeng_online/Yifeng_2.png new file mode 100644 index 0000000000000000000000000000000000000000..97ebd04977174efb7a5915ec3a0c48c54699a745 Binary files /dev/null and b/models/yifeng_online/Yifeng_2.png differ diff --git a/models/yifeng_online/Yifeng_3.png b/models/yifeng_online/Yifeng_3.png new file mode 100644 index 0000000000000000000000000000000000000000..aa31c4af75bcb279c82ef6f2b3a0b306574a97b2 Binary files /dev/null and b/models/yifeng_online/Yifeng_3.png differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d5f5d067c2daef92b0f61f41e9aaf6d3d3b9a69 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +opencv-python +gradio==4.36.1 +gradio-client==1.0.1 \ No newline at end of file