Spaces:
Running
on
T4
Running
on
T4
File size: 1,868 Bytes
07d5247 80acf00 5547b3f 84cba60 07d5247 8a8a448 07d5247 8a8a448 07d5247 8f8756e 06aaa62 4c74ec7 778d80b 2409049 2825dd1 |
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: 77 Token (Keyword) Limit'),
gr.Slider(1, 25, value = 10, label = 'Guidance Scale: How close to follow Prompt'),
gr.Slider(20, 100, value = 50, step = 1, label = 'Number of Iterations: more take longer and may or may not improve image quality'),
gr.Slider(.01, 100, value=1, label='Temperature: Changes probability of Diffusion to Image Array, more info in community comments')], 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. Simply type in what you wish to see, adjust the sliders (optional) and click submit. For more information on Keras see https://keras.io/about/ For more informationon about Stable Diffusion or Suggestions for prompts, keywords, artists or styles see https://github.com/Maks-s/sd-akashic <br><br><b>DISCLAIMER: This Text to Image Pipeline has the potential to produce NSFW, Disturbing, or Offensive Images. I am not responsible for what images you produce or what you do with them. By using this Gradio API you consent to taking full responsibility for the images you produce and agree that you are at least 18 years of age.', article = "Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>")
iface.launch(max_threads=True) |