Spaces:
Runtime error

nico2rdj commited on
Commit
d0e8d70
Β·
1 Parent(s): 3dab84f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +86 -0
app.py CHANGED
@@ -122,4 +122,90 @@ def inference(
122
 
123
 
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
 
122
 
123
 
124
 
125
+ with gr.Blocks() as blocks:
126
+
127
+
128
+ with gr.Row():
129
+ with gr.Column():
130
+ qr_code_content = gr.Textbox(
131
+ label="error",
132
+ info="",
133
+ value="",
134
+ )
135
+ with gr.Accordion(label="", open=False):
136
+ qr_code_image = gr.Image(
137
+ label="",
138
+ type="pil",
139
+ )
140
+
141
+ prompt = gr.Textbox(
142
+ label="",
143
+ info="",
144
+ )
145
+ negative_prompt = gr.Textbox(
146
+ label="",
147
+ value="ugly, disfigured, low quality, blurry, nsfw",
148
+ )
149
+ use_qr_code_as_init_image = gr.Checkbox(label="", value=True, interactive=False, info="")
150
+
151
+ with gr.Accordion(label="", open=False, visible=False) as init_image_acc:
152
+ init_image = gr.Image(label="", type="pil")
153
+
154
+
155
+ with gr.Accordion(
156
+ label="",
157
+ open=True,
158
+ ):
159
+ controlnet_conditioning_scale = gr.Slider(
160
+ minimum=0.0,
161
+ maximum=5.0,
162
+ step=0.01,
163
+ value=1.1,
164
+ label="",
165
+ )
166
+ strength = gr.Slider(
167
+ minimum=0.0, maximum=1.0, step=0.01, value=0.9, label=""
168
+ )
169
+ guidance_scale = gr.Slider(
170
+ minimum=0.0,
171
+ maximum=50.0,
172
+ step=0.25,
173
+ value=7.5,
174
+ label="",
175
+ )
176
+ sampler = gr.Dropdown(choices=list(SAMPLER_MAP.keys()), value="DPM++ Karras SDE", label="Sampler")
177
+ seed = gr.Slider(
178
+ minimum=-1,
179
+ maximum=9999999999,
180
+ step=1,
181
+ value=2313123,
182
+ label="Seed",
183
+ randomize=True,
184
+ )
185
+ with gr.Row():
186
+ run_btn = gr.Button("")
187
+ with gr.Column():
188
+ result_image = gr.Image(label="")
189
+ run_btn.click(
190
+ inference,
191
+ inputs=[
192
+ qr_code_content,
193
+ prompt,
194
+ negative_prompt,
195
+ guidance_scale,
196
+ controlnet_conditioning_scale,
197
+ strength,
198
+ seed,
199
+ init_image,
200
+ qr_code_image,
201
+ use_qr_code_as_init_image,
202
+ sampler,
203
+ ],
204
+ outputs=[result_image],
205
+ )
206
+
207
+
208
+
209
+ blocks.queue(concurrency_count=1, max_size=20)
210
+ blocks.launch(share=bool(os.environ.get("SHARE", False)))
211