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. https://keras.io/about/') gr.HTML( """

LICENSE

The model is licensed with a CreativeML Open RAIL-M license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please read the license

Biases and content acknowledgment

Despite how impressive being able to turn text into image is, beware to the fact that this model may output content that reinforces or exacerbates societal biases, as well as realistic faces, pornography and violence. The model was trained on the LAION-5B dataset, which scraped non-curated image-text-pairs from the internet (the exception being the removal of illegal content) and is meant for research purposes. You can read more in the model card

""" ) iface.launch()