Skip to content

Commit 728f441

Browse files
authored
Merge pull request #36 from intel/version_1_4
Added SD-1.5-Inpainting and modified init image support in GUI
2 parents 39948ca + 17c674d commit 728f441

File tree

7 files changed

+762
-98
lines changed

7 files changed

+762
-98
lines changed

README.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This branch is currently under development. <br>Dedicated for GIMP 3, Python 3 a
99
[2] Style-Transfer <br>
1010
[3] Inpainting <br>
1111
[4] Semantic-Segmentation <br>
12-
[5] Stable-Diffusion <br>
12+
[5] Stable-Diffusion (Suppports - SD 1.4, SD 1.5 (landscape & portrait), SD 1.5 Inpainting) <br>
1313

1414
# Objectives
1515
[1] Provides a set of OpenVino based plugins that add AI features to GIMP. <br>
@@ -26,14 +26,26 @@ Please raise a PR for any new features, modifactions or bug fixes.
2626
## Installation Steps
2727

2828
### Windows
29+
Skip steps 1 and 2 if you already have Python3 and Git on Windows
30+
31+
#### 1. Install Python
32+
- Download a Python installer from python.org. Choose Python 3.7, 3.8, 3.9 or 3.10 and make sure to pick a 64 bit version. For example, this 3.8 installer: https://www.python.org/ftp/python/3.8.8/python-3.8.8-amd64.exe <br>
33+
- Double click on the installer to run it, and follow the steps in the installer. Check the box to add Python to your PATH, and to install py. At the end of the installer, there is an option to disable the PATH length limit. It is recommended to click this. <br>
34+
35+
#### 2. Install Git
36+
- Download and install [GIT](https://git-scm.com/)
37+
38+
#### 3. Install the GIMP Plugin
39+
2940
1. Install [GIMP 2.99.10 (revision 2)](https://download.gimp.org/gimp/v2.99/windows/gimp-2.99.10-setup-2.exe) or Install [GIMP 2.99.14](https://download.gimp.org/gimp/v2.99/windows/gimp-2.99.14-setup.exe) <br>
30-
2. Clone, run install script: <br>
41+
2. Clone and run install script: <br>
3142

3243
- clone this repo: <br>
3344
```git clone https://github.com/intel/openvino-ai-plugins-gimp.git``` <br>
3445

3546
- run install script - this will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup. <br>
3647
```openvino-ai-plugins-gimp\install.bat``` <br>
48+
*You can re-run "run install script" step later again to install & setup models that you may have missed.* <br>
3749

3850
3. Start the GIMP application, and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins]. <br>
3951
Example: ```Plug-ins in GIMP : <path\to>\gimpenv3\lib\site-packages\gimpopenvino\plugins``` Add this path to [Edit-> Preferences-> Folders-> Plugins] in GIMP <br>
@@ -47,20 +59,38 @@ Please raise a PR for any new features, modifactions or bug fixes.
4759
# clone this repo:
4860
git clone https://github.com/intel/openvino-ai-plugins-gimp.git
4961
50-
# run install script - this will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup
62+
# run install script - this will create the virtual environment "gimpenv3", install all required packages and will also walk you through models setup.
5163
openvino-ai-plugins-gimp/install.sh
5264
```
65+
*You can re-run "run install script" step later again to install & setup models that you may have missed.* <br>
66+
5367
3. Start the GIMP application (```flatpak run org.gimp.GIMP```), and add the gimpenv3 path that was printed when running the above step to the list of plugin folders [Edit-> Preferences-> Folders-> Plugins]. <br>
5468
4. Restart GIMP, and you should see 'OpenVINO-AI-Plugins' show up in 'Layer' menu <br>
5569

5670
### OpenVINO™ Image Generator Plugin with Stable Diffusion - This GIF doesn't represent the current GUI
71+
#### A. Prompt to Image
5772
1. Create or choose a layer <br>
5873
2. Select Stable Diffusion from the drop down list in layers -> OpenVINO-AI-Plugins <br>
5974
3. Choose the desired model and device from the drop down list.<br>
6075
4. Click on "Load Models" to compile & load the model on the selected device. Wait for it to complete. Please note that you need to perform this step only if you change the model or device or both. For any subsequent runs just click "Run Inference" <br>
61-
3. Enter prompt and other parameters <br>
62-
4. Click on “Run Inference”. Wait for the total inference steps to get completed. <br>
63-
6. If create gif option is selected, please note that performance will reduce. The generated gif is located in below path. You can play it in GIMP by going to Filters -> Animations -> Playback <br>
76+
5. Enter prompt and other parameters <br>
77+
6. Click on “Run Inference”. Wait for the total inference steps to get completed. <br>
78+
79+
#### B. Image to Image
80+
1. Create or choose a layer or open an image <br>
81+
2. Follow steps 2,3,4,5 from section A. <br>
82+
3. Select "Use Initial Image"
83+
4. By default the opened image in canvas will be used as initial image to the model. You can also select a different image by browsing from files.
84+
5. Click on “Run Inference”. Wait for the total inference steps to get completed. <br>
85+
86+
#### C. Stable-Diffusion-1.5 Inpainting - Make sure to download and convert the model during install process.
87+
1. Choose a layer or Open an image of size 512x512. (Currently works best with this resolution) <br>
88+
2. Use "Free select tool" to select the area in your image that you wish to change. <br>
89+
3. Right click on you image and click on "Add layer mask". Then choose "Selection" in "Initalize layer Mask to". This should create a mask with your selection.
90+
4. Follow steps 2,3,4,5 from section A. Please note that you will only see "SD_1.5_Inpainting" in model options if you added a mask layer to your image. <br>
91+
5. Click on “Run Inference”. Wait for the total inference steps to get completed. <br>
92+
93+
*If create gif option is selected, please note that performance will reduce. The generated gif is located in below path. You can play it in GIMP by going to Filters -> Animations -> Playback* <br>
6494
```C:\Users\<user_name>\openvino-ai-plugins-gimp\gif\stable_diffusion.gif``` <br>
6595

6696
![](gifs/stable-diffusion.png)

choose_sd_model.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,31 @@
1616
print("3 - Portrait (360x640 output image, 9:16) ")
1717
print("4 - Portrait_512x768 (512x768 output image), will take time since model is large ")
1818
print("5 - Landscape_768x512 (768x512 output image), will take time since model is large ")
19-
print("6 - ALL the above SD-1.5 models ")
20-
print("7 - Only Square, Landscape, Portrait")
21-
print("8 - Skip All SD-1.5 Model setup ")
19+
print("6 - SD-1.5 Inapinting model (512x512 output image) ")
20+
print("7 - ALL the above SD-1.5 models ")
21+
print("8 - Only Square, Landscape, Portrait")
22+
print("9 - Skip All SD-1.5 Model setup ")
2223

2324
while True:
2425
choice = input("Enter the Number for the model you want to download & convert: ")
2526

26-
if choice=="6":
27-
for i in range(1,6):
27+
# setup all the SD1.5 models
28+
if choice=="7":
29+
for i in range(1,7):
2830

2931
subprocess.call([sd_python_path, chose_model, str(i)])
3032

3133
break
32-
elif choice=="7":
34+
# setup only square, landscape and Portrait
35+
elif choice=="8":
3336
for i in range(1,4):
3437

3538
subprocess.call([sd_python_path, chose_model, str(i)])
3639
break
37-
elif choice=="8":
40+
elif choice=="9":
3841
print("Exiting SD-1.5 Model setup.........")
3942
break
40-
elif choice in ["1","2","3","4","5"]:
43+
elif choice in ["1","2","3","4","5","6"]:
4144

4245
subprocess.call([sd_python_path, chose_model, choice])
4346

gifs/stable-diffusion.png

-3.26 KB
Loading

0 commit comments

Comments
 (0)