File size: 659 Bytes
2f8f99c
c3b1c74
 
 
2f8f99c
c3b1c74
2f8f99c
 
c3b1c74
2f8f99c
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from diffusers import DiffusionPipeline
import gradio as gr
from diffusers import DiffusionPipeline

model_id = "CompVis/ldm-text2im-large-256"

# load model and scheduler
ldm = DiffusionPipeline.from_pretrained(model_id)

def generate_image(Prompt):
    images = ldm([Prompt], num_inference_steps=50, eta=.3, guidance_scale=6)
    return images.images[0]
    
interface = gr.Interface(fn = generate_image,inputs = "text",outputs = "image",title = "Compviz Image Generator App", description = "Type in a text and click submit to generate an image:", examples = ["a clown reading a book", "Cat in Paris", "An elephant on grass"])
interface.launch(share = True)