{"id":20715669,"url":"https://github.com/ovshake/stable-fashion","last_synced_at":"2025-04-23T10:44:13.893Z","repository":{"id":62882519,"uuid":"531016674","full_name":"ovshake/stable-fashion","owner":"ovshake","description":"Stable Fashion: A prompt based virtual try on repository","archived":false,"fork":false,"pushed_at":"2022-12-05T13:11:47.000Z","size":35727,"stargazers_count":87,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T23:22:46.205Z","etag":null,"topics":["fashion","pytorch","stable-diffusion","try-on"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ovshake.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-31T09:30:17.000Z","updated_at":"2025-02-14T03:11:40.000Z","dependencies_parsed_at":"2023-01-23T03:30:14.175Z","dependency_job_id":null,"html_url":"https://github.com/ovshake/stable-fashion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovshake%2Fstable-fashion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovshake%2Fstable-fashion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovshake%2Fstable-fashion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ovshake%2Fstable-fashion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ovshake","download_url":"https://codeload.github.com/ovshake/stable-fashion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250419385,"owners_count":21427592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fashion","pytorch","stable-diffusion","try-on"],"created_at":"2024-11-17T02:39:29.201Z","updated_at":"2025-04-23T10:44:13.874Z","avatar_url":"https://github.com/ovshake.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stable Fashion\n[![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/maiti/stable-fashion)\n \u003c!-- ![image info](assets/logo-black.png  =x250)--\u003e\n \u003cimg align=\"center\" src=\"assets/logo-black.png \" alt=\"drawing\" width=\"300\" /\u003e\n\n*How would you look like in a gray jacket or a pink striped t-shirt?*\n\nDecisions like this are very important when you are buying apparels from various e-commerce websits\nlike Amazon, Myntra etc. More often than not, we end up returning these ordered items,\nbecause they don't look like you had imagined.\nWhy don't we ease the stress we put on our imagination by using state of the art generative modeling to help us.\n\nIntroducing Stable Fashion, a prompt-based on try-on app (well, only code for now), where you can write prompts such as \"**A pink t shirt**\" or\n\"**A yellow adidas shirt with black stripes**\" and it would edit to put those clothing items on a full length picture of yours.\n\n**NEW**\n\nNow you can try out the demo on [Huggingface Spaces](https://huggingface.co/spaces): [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/maiti/stable-fashion)\n\n# Instructions to Run\n\n1. Please ensure `anaconda` is installed in your system. If not, you can follow the instructions [here](https://www.anaconda.com/products/distribution).\n2. Run the following command\n```\nconda create -n sf python=3.9\nconda activate sf\ncat requirements.txt | xargs -n 1 pip install\n```\n\n3. To run the pipeline, use this sample command\n```\npython main.py --image ../../assets/stockimage.jpeg --resolution 512  --prompt \"yellow shirt\"  --part upper  --num_steps 25   --output stock_yellow.jpg\n```\nOther available options are\n```\nStable Fashion API, allows you to picture yourself in any cloth your imagination can think of!\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --image IMAGE         path to image\n  --part {upper,lower}\n  --resolution {256,512,1024,2048}\n  --prompt PROMPT\n  --num_steps NUM_STEPS\n  --guidance_scale GUIDANCE_SCALE\n  --rembg\n  --output OUTPUT\n```\n4. The image will be saved as whatever name you provide with `--output`. The default is `output.jpg`. in the root directory of the project.\n# Things to Keep in Mind\n\n1. Please ensure you only describe the clothing item in your prompt. Any other information throws off the model for the time being.\n\n:white_check_mark: A green hoodie\n\n:x: A green hoodie wrapped around the waist\n\n2. ~~Currently, the code relies on a GPU. Please ensure you have an NVIDIA GPU with the appropiate CUDA kernel.~~ Now you can run the pipeline on CPU as well, although it will take considerably more time.\n\n3. Please ensure your full length picture is taken from front, with a whitish background. It helps the model to isolate you in the picture. **NEW**: now you can use the `rembg` option to turn a normal in-the-wild picture into a picture with white background.\n\n4. You can mention which part of the picture you want to dress up, `upper` (torso) or `lower` (pants, trousers etc)\n\n\n# Models Used\nFor this app, first we segment the human out of the image. For this we use [rembg](https://github.com/danielgatis/rembg). Then we segment the upper and lower clothes using the [cloth segmentation repository](https://github.com/levindabhi/cloth-segmentation). On top of this we run the [stable diffusion inpainting pipeline](https://huggingface.co/runwayml/stable-diffusion-inpainting) from huggingface.\n\n\n\n# Results\n\nThese are some of the results of the prompts on a stock full length image.\n\n| Original Image | Prompt: a yellow shirt  | Prompt: A pink shirt |\n|----------------|---------------------------------|--------------------------------|\n|  ![image info](assets/stockimage.jpeg)              |   ![image info](assets/stock_yellow.jpg)                               |   ![image info](assets/pink.png)                             |\n\n# Next Steps\n\n- [x] Converting this to a single read, single write code-base.\n- [x] Adding CPU support\n- [ ] Wrapping this up in an API and hosting it\n- [x] Making an UI (put on HF spaces for now)\n\n# Acknowledgments\n\nThanks to huggingface, runway-ml and @levindabhi for their wonderful codebases.\n\n# Feedback\nThis is a hobby project and has some pretty gaping holes. I am very happy to recieve feedback and PRs. You can reach out to me on\ntwitter: [@o_v_shake](https://twitter.com/o_v_shake) or open an issue in this repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovshake%2Fstable-fashion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovshake%2Fstable-fashion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovshake%2Fstable-fashion/lists"}