vsrinivas commited on
Commit
b8e6b8f
·
verified ·
1 Parent(s): 36d6eb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -22
app.py CHANGED
@@ -20,27 +20,31 @@ def generate(prompt,steps,guidance,width,height):
20
  pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
21
 
22
 
23
- with gr.Blocks() as demo:
24
- gr.Markdown("# Image Generation Demo & Test App by Srinivas")
25
- gr.Markdown("## Generates an Image based on Your Promt inputted and Optional parameters selected")
26
- with gr.Row():
27
- with gr.Column(scale=4):
28
- prompt = gr.Textbox(label="Your Prompt") #Give prompt some real estate
29
- with gr.Column(scale=1, min_width=50):
30
- btn = gr.Button("Submit") #Submit button side by side!
31
- with gr.Accordion("Advanced options", open=False): #Let's hide the advanced options!
32
- # negative_prompt = gr.Textbox(label="Negative prompt")
33
- with gr.Row():
34
- with gr.Column():
35
- steps = gr.Slider(label="Inference Steps", minimum=1, maximum=100, value=25,
36
- info="In many steps will the denoiser denoise the image?")
37
- guidance = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=20.0, value=7.0,
38
- info="Controls how much the text prompt influences the result")
39
- with gr.Column():
40
- width = gr.Slider(label="Width", minimum=64, maximum=512, step=64, value=512)
41
- height = gr.Slider(label="Height", minimum=64, maximum=512, step=64, value=512)
42
- output = gr.Image(label="Result") #Move the output up too
43
 
44
- btn.click(fn=generate, inputs=[prompt,steps,guidance,width,height], outputs=[output])
45
 
46
- demo.launch()
 
 
 
 
 
20
  pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
21
 
22
 
23
+ # with gr.Blocks() as demo:
24
+ # gr.Markdown("# Image Generation Demo & Test App by Srinivas")
25
+ # gr.Markdown("## Generates an Image based on Your Promt inputted and Optional parameters selected")
26
+ # with gr.Row():
27
+ # with gr.Column(scale=4):
28
+ # prompt = gr.Textbox(label="Your Prompt") #Give prompt some real estate
29
+ # with gr.Column(scale=1, min_width=50):
30
+ # btn = gr.Button("Submit") #Submit button side by side!
31
+ # with gr.Accordion("Advanced options", open=False): #Let's hide the advanced options!
32
+ # # negative_prompt = gr.Textbox(label="Negative prompt")
33
+ # with gr.Row():
34
+ # with gr.Column():
35
+ # steps = gr.Slider(label="Inference Steps", minimum=1, maximum=100, value=25,
36
+ # info="In many steps will the denoiser denoise the image?")
37
+ # guidance = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=20.0, value=7.0,
38
+ # info="Controls how much the text prompt influences the result")
39
+ # with gr.Column():
40
+ # width = gr.Slider(label="Width", minimum=64, maximum=512, step=64, value=512)
41
+ # height = gr.Slider(label="Height", minimum=64, maximum=512, step=64, value=512)
42
+ # output = gr.Image(label="Result") #Move the output up too
43
 
44
+ # btn.click(fn=generate, inputs=[prompt,steps,guidance,width,height], outputs=[output])
45
 
46
+ # demo.launch()
47
+
48
+ from transformers import launch_gradio_demo
49
+
50
+ launch_gradio_demo(generate)