Instructions to use Jl-wei/ui-diffuser-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Jl-wei/ui-diffuser-v2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-base", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Jl-wei/ui-diffuser-v2") prompt = "Mobile app:" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
| tags: | |
| - text-to-image | |
| - stable-diffusion | |
| - lora | |
| - diffusers | |
| language: | |
| - en | |
| library_name: diffusers | |
| pipeline_tag: text-to-image | |
| base_model: stabilityai/stable-diffusion-2-base | |
| instance_prompt: "Mobile app:" | |
| # UI-Diffuser-V2 | |
| UI-Diffuser-V2 is fine tuned from "stabilityai/stable-diffusion-2-base" with the [SCapRepo dataset](https://paperswithcode.com/dataset/gpscap) for mobile UI generation. | |
| A demo using diffusion model and large language model for UI generation is available at https://github.com/Jl-wei/ai-gen-ui | |
| ## Using with Diffusers | |
| ```python | |
| import torch | |
| from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
| model_id = "stabilityai/stable-diffusion-2-base" | |
| scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler") | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16) | |
| lora_path = "Jl-wei/ui-diffuser-v2" | |
| pipe.load_lora_weights(lora_path) | |
| pipe.to("cuda") | |
| prompt = "Mobile app: health monitoring report" | |
| images = pipe(prompt, num_inference_steps=30, guidance_scale=7.5, height=512, width=288, num_images_per_prompt=10).images | |
| columns = 5 | |
| fig = plt.figure(figsize=(20,10)) | |
| for i, image in enumerate(images): | |
| plt.subplot(int(len(images) / columns), columns, i + 1) | |
| plt.imshow(image) | |
| for ax in fig.axes: | |
| ax.axis("off") | |
| ``` | |
| ## Citation | |
| If you find our work useful, please cite our paper: | |
| ```bibtex | |
| @article{wei2024aiinspired, | |
| author={Wei, Jialiang and Courbis, Anne-Lise and Lambolais, Thomas and Dray, Gérard and Maalej, Walid}, | |
| journal={IEEE Software}, | |
| title={On AI-Inspired User Interface Design}, | |
| year={2025}, | |
| volume={42}, | |
| number={3}, | |
| pages={50-58}, | |
| doi={10.1109/MS.2025.3536838} | |
| } | |
| ``` | |
| Please note that the code and model can only be used for academic purpose. | |
| ### UI-Diffuser-V1 | |
| This model, UI-Diffuser-V2, represents the second version of the UI-Diffuser model. | |
| The initial version, UI-Diffuser-V1, was introduced in our paper titled [Boosting GUI Prototyping with Diffusion Models](https://ieeexplore.ieee.org/abstract/document/10260853) |