File size: 2,783 Bytes
07d5247
 
 
 
 
 
 
84cba60
07d5247
8a8a448
07d5247
8a8a448
 
 
07d5247
 
 
 
8f8756e
07d5247
 
 
2ac8086
a7e34da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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(
            """
                <div class="footer">
                    <p> Gradio Demo by 🤗 Majushri
                    </p>
                </div>
                <div class="acknowledgments">
                    <p><h4>LICENSE</h4>
The model is licensed with a <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" style="text-decoration: underline;" target="_blank">CreativeML Open RAIL-M</a> 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 <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" target="_blank" style="text-decoration: underline;" target="_blank">read the license</a></p>
                    <p><h4>Biases and content acknowledgment</h4>
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 <a href="https://laion.ai/blog/laion-5b/" style="text-decoration: underline;" target="_blank">LAION-5B dataset</a>, 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 <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" style="text-decoration: underline;" target="_blank">model card</a></p>
               </div>
           """
        )

iface.launch()