SDL. - Stable Diffusiom Local System

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > SD - Stable Diffusion AI >

SDL. - Stable Diffusiom Local System

Using Stable Diffusion to generate Pictures

Previous Top Next

 

Stable Diffusion on your own Computer (Local)

 

To use Stable Diffusion Online, you will need to
Install and prepare Local Stable Diffusion

 

You can then test your installation using the WEB-GUI from Automatic1111.

Once tested, you can use SD with the SPR. The local version of Stable diffusion is uncensored.

Therefore watch what you enter.

 

clip0745

Once tested you can use Stable Diffusion with the SPR.

 


The following Sample-Code will take your Theme-Prompt, ask Open AI "ChatGPT" to improve it.

And then generate the Picture with SDL.
 

You need to have your OpenAI API-Key saved locally in the Scriptfolder using the Save_Key Command.

 

VAR.$$THE="neural network beautiful golden girl Galaxy robot digital photorealistic NC-1701 enterprise"

VAR.$$PAO=Please make me a prompt below 231 characters, for stable diffusion using the following Theme: $$THE. Please only the result and no further comments.

' Use Image Register 0

VIN.$$IMR=0

 

' Set OpenAI API-Key from the saved File

AIC.SetKey|File

' Set Model-Temperature

AIC.Set_Temperature|0

 

' Set Max-Tokens (Possible lenght of answer, depending on the Model up to 2000 Tokens which is about ~6000 characters)

' The more Tokens you use the more you need to pay. But the longer Input and Output can be.

AIC.SetMax_Token|300

 

FOR.$$STP|1|25

  AIC.Ask_Chat|$$PAO|$$RET

  DBP. Got: <<$$RET >>

  $$FIR=?path\Sample Pics\Testresult_?.png

  FIL.gen|$$FIR|1|0|$$FIL

  SDL.gtf|$$RET|$$FIL

  ANA.Load|$$IMR|$$FIL

  ' This will print a Text inside the Picture

  $$TXT=SPR/SDO. generated: $$STP Steps

  $$COA=&HFFFFFF

  $$COB==&H0

  $$BGC=-2

  $$XPA=30

  $$YPA=450

  ANA.PrintAt|$$IMR|$$TXT|$$COA|$$BGC|$$XPA|$$YPA|24

  ANA.PrintAt|$$IMR|$$TXT|$$COB|$$BGC|($$XPA+1)|($$YPA+2)|24

  ' Mow we load the picture

  DBP.Loaded in IR:$$IMR -> $$FIL

  ANA.Show|$$IMR!

NEX.

ENR.