Welcome to ROSMASTER M3 repository
12. Multimodal Text-Based Image Application
Multimodal Text-to-Image Applications
Multimodal Text-to-Image Applications1. Concept Introduction1.1 What is Text-to-Image?Core Principles1.2 What is FastSDCPU?Core FeaturesApplicable Scenarios2. Project Deployment2.1 Deployment Environment2.2 LAN Access2.3 Using the Vinyl Image Function2.4 How to start after successful deployment
Since Ollam doesn't support text-to-image functionality, we need to use other tools to implement local text-to-image functionality.
1. Concept Introduction
1.1 What is Text-to-Image?
Text-to-image is an artificial intelligence technology that automatically generates corresponding images based on text descriptions. Simply input a text (e.g., "A Shiba Inu wearing sunglasses is surfing on the beach"), and the AI model will generate an image that matches the description based on semantic understanding, requiring no drawing or design skills.
Core Principles
- Language Understanding: The AI first parses your text and identifies keywords (such as "Shiba Inu," "sunglasses," and "beach").
- Image Generation: Based on training with massive amounts of image data, the AI converts text into visual elements and combines them into a reasonable image.
- Style Adaptation: You can specify a style (realistic, cartoon, watercolor, etc.), and the AI will adjust the generated effect.
1.2 What is FastSDCPU?
FastSDCPU is an open-source project for stable diffusion image generation, specifically optimized for CPU devices. Through algorithmic and engineering optimizations, it enables the rapid generation of high-quality images on ordinary computers without GPUs, significantly lowering the hardware barrier for AI painting.
Core Features
- Pure CPU Operation: No dedicated graphics card required; can run directly on laptops, desktops, or edge devices.
- High-Speed Inference: Combining technologies such as Latent Consistency Models (LCM), images can be generated in just 4–8 steps, significantly reducing waiting time.
- Lightweight Deployment: Supports model quantization (such as INT8) and OpenVINO acceleration, reducing resource consumption and improving response efficiency.
Applicable Scenarios
- Localized AI Creation Tools
- Enterprise Intranet Image Generation Service
- Teaching Demonstrations and Prototype Development
- Lightweight Deployment in Resource-Constrained Environments
2. Project Deployment
2.1 Deployment Environment
Note: If using our factory image, no deployment environment is required; skip the deployment steps. Refer directly to <2.4 Startup Method After Successful Deployment> at the bottom to start. Then return to <2.3 Using the Text-to-Image Function> to learn how to use it.
Open a terminal and execute the following code:
xxxxxxxxxx#If there is no git on the mainboard, runsudo apt updatesudo apt install git -ysudo apt install python3.10-venv -y#Add environment variablesecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc# Clone the project codegit clone https://github.com/rupeshs/fastsdcpu.gitcd fastsdcpu# Create a virtual environment and install dependenciespython -m venv venvsource venv/bin/activate#Install uvcurl -Ls https://astral.sh/uv/install.sh | sh(This step may not be successful if there is no proxy in China. If not, you can skip this step and execute the next command)#If the curl command failed to install uv in the previous step, run these three instructionswget https://mirrors.huaweicloud.com/astral/uv/0.8.4/uv-aarch64-unknown-linux-gnu -O ~/.local/bin/uvchmod +x ~/.local/bin/uv~/.local/bin/uv --versionchmod +x install.sh start-webui.sh./install.sh --disable-gui
Installation successful, press any key to exit:

2.2 LAN Access
Before starting, you need to modify a file to support LAN access. Otherwise, the webUI can only be accessed locally:
xxxxxxxxxxvim ~/fastsdcpu/src/frontend/webui/ui.py
After opening the ui.py file, scroll to the last line and find webui.launch(share=share). Change it to webui.launch(server_name="0.0.0.0",share=share).
Save the file.
Start:
xxxxxxxxxx./start-webui.sh

Then, enter your mainboard's IP address: 7860 in your browser to access the webUI.
2.3 Using the Vinyl Image Function
Use ifconfig in the terminal to query your mainboard's IP address. For example, mine is 192.168.2.106.
Then open your browser and enter your mainboard's IP address: 7860 . For example, I entered 192.168.2.106:7860 . This will allow you to access the webUI.

Next, click LCM-LoRA. This model uses less memory. If you prefer, feel free to explore other models.
Next, click Models to view the LCM LoRA model settings. You can change the model you want, or just stick with the default, as I did.

Next, click Generation Settings and increase the Inference Steps setting to improve the quality of the generated image. I've set it to 5.

Next, return to the Text to Image dialog box and enter the content you want to generate. Click Generate to begin generating the image.

For first-time users, you'll need to download the model. You'll see the default model being downloaded in the terminal. Once it's finished downloading, the text-to-image function will begin.

Generated result:

This project has better support for English, and the generated images are more consistent with the text. We recommend using English descriptions when generating images.
2.4 How to start after successful deployment
xxxxxxxxxxcd fastsdcpu #Enter the fastsdcpu directorysource venv/bin/activate #Enter the virtual environment./start-webui.sh #Start the webui
After the webui is successfully started, enter your mainboard's IP address: 7860 in your browser to start the image generation function.