SMarioMan commited on
Commit
c5a6293
·
1 Parent(s): b723632

Fix negative prompts

Browse files
Files changed (1) hide show
  1. app.py +11 -34
app.py CHANGED
@@ -103,18 +103,17 @@ with gr.Blocks(css=css) as demo:
103
  """,
104
  elem_id="intro",
105
  )
106
- with gr.Row():
107
- with gr.Row():
108
- prompt = gr.Textbox(
109
- placeholder="Insert your prompt here:", scale=5, container=False
110
- )
111
- negative_prompt = gr.Textbox(
112
- placeholder="Insert your negative prompt here:", scale=5, container=False
113
- )
114
- generate_bt = gr.Button("Generate", scale=1)
115
 
116
  image = gr.Image(type="filepath")
117
- with gr.Accordion("Advanced options", open=False):
118
  guidance = gr.Slider(
119
  label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
120
  )
@@ -122,33 +121,11 @@ with gr.Blocks(css=css) as demo:
122
  seed = gr.Slider(
123
  randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
124
  )
125
- with gr.Accordion("Run with diffusers"):
126
- gr.Markdown(
127
- """## Running LCM-LoRAs it with `diffusers`
128
- ```bash
129
- pip install diffusers==0.23.0
130
- ```
131
-
132
- ```py
133
- from diffusers import DiffusionPipeline, LCMScheduler
134
-
135
- pipe = DiffusionPipeline.from_pretrained("Lykon/dreamshaper-7").to("cuda")
136
- pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
137
- pipe.load_lora_weights("latent-consistency/lcm-lora-sdv1-5") #yes, it's a normal LoRA
138
-
139
- results = pipe(
140
- prompt="The spirit of a tamagotchi wandering in the city of Vienna",
141
- num_inference_steps=4,
142
- guidance_scale=0.0,
143
- )
144
- results.images[0]
145
- ```
146
- """
147
- )
148
 
149
- inputs = [prompt, guidance, steps, seed]
150
  generate_bt.click(fn=predict, inputs=inputs, outputs=image, show_progress=False)
151
  prompt.input(fn=predict, inputs=inputs, outputs=image, show_progress=False)
 
152
  guidance.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)
153
  steps.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)
154
  seed.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)
 
103
  """,
104
  elem_id="intro",
105
  )
106
+
107
+ prompt = gr.Textbox(
108
+ placeholder="Insert your prompt here:", scale=5, container=False
109
+ )
110
+ negative_prompt = gr.Textbox(
111
+ placeholder="Insert your negative prompt here:", scale=5, container=False
112
+ )
113
+ generate_bt = gr.Button("Generate", scale=1)
 
114
 
115
  image = gr.Image(type="filepath")
116
+ with gr.Accordion("Advanced options", open=True):
117
  guidance = gr.Slider(
118
  label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
119
  )
 
121
  seed = gr.Slider(
122
  randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
123
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
+ inputs = [prompt, negative_prompt, guidance, steps, seed]
126
  generate_bt.click(fn=predict, inputs=inputs, outputs=image, show_progress=False)
127
  prompt.input(fn=predict, inputs=inputs, outputs=image, show_progress=False)
128
+ negative_prompt.input(fn=predict, inputs=inputs, outputs=image, show_progress=False)
129
  guidance.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)
130
  steps.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)
131
  seed.change(fn=predict, inputs=inputs, outputs=image, show_progress=False)