File size: 1,234 Bytes
07d5247
 
 
 
 
 
 
84cba60
07d5247
8a8a448
07d5247
8a8a448
 
 
07d5247
 
 
 
8f8756e
07d5247
 
 
84cba60
07d5247
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from stable_diffusion_tf.stable_diffusion import Text2Image
from PIL import Image
import gradio as gr

generator = Text2Image(
    img_height=512,
    img_width=512,
    jit_compile=False)

def txt2img(prompt, guide, steps, Temp):
    img = generator.generate(prompt,
    num_steps=steps,
    unconditional_guidance_scale=guide,
    temperature=Temp,
    batch_size=1)
    image=Image.fromarray(img[0])
    return image

iface = gr.Interface(fn=txt2img, inputs=[
    gr.Textbox(label = 'Input Text Prompt'),
    gr.Slider(2, 20, value = 9, label = 'Guidence Scale'),
    gr.Slider(10, 100, value = 50, step = 1, label = 'Number of Iterations'),
    gr.Slider(.01, 100, value=1)], outputs = 'image',title='Stable Diffusion with Keras and TensorFlow CPU or GPU', description='Now Using Keras and TensorFlow with Stable Diffusion. This allows very complex image generation with less code footprint, and less text.', footer='About Keras: Keras is a deep learning API written in Python, running on top of the machine learning platform TensorFlow. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result as fast as possible is key to doing good research. https://keras.io/about/')
iface.launch()