achiru commited on
Commit
939851d
1 Parent(s): a0dff2d

tweak code style, default values, markdown

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -77,7 +77,7 @@ def inference(
77
  guidance_scale: float = 10.0,
78
  controlnet_conditioning_scale: float = 2.0,
79
  seed: int = -1,
80
- sampler="DPM++ Karras SDE",
81
  ):
82
  if prompt is None or prompt == "":
83
  raise gr.Error("Prompt is required")
@@ -99,15 +99,14 @@ def inference(
99
  prompt=prompt,
100
  negative_prompt=negative_prompt,
101
  image=qrcode_image,
102
- width=qrcode_image.width, # type: ignore
103
- height=qrcode_image.height, # type: ignore
104
  guidance_scale=float(guidance_scale),
105
- controlnet_conditioning_scale=float(
106
- controlnet_conditioning_scale), # type: ignore
107
  generator=generator,
108
  num_inference_steps=40,
109
  )
110
- return out.images[0] # type: ignore
111
 
112
 
113
  css = """
@@ -167,7 +166,6 @@ Try our more powerful v2 here: https://qrcodemonster.art!
167
  value=1.5,
168
  label="Controlnet Conditioning Scale",
169
  info="""Controls the readability/creativity of the QR code.
170
-
171
  High values: The generated QR code will be more readable.
172
  Low values: The generated QR code will be more creative.
173
  """
@@ -194,8 +192,7 @@ Try our more powerful v2 here: https://qrcodemonster.art!
194
  with gr.Row():
195
  run_btn = gr.Button("Run")
196
  with gr.Column():
197
- result_image = gr.Image(
198
- label="Result Image", elem_id="result_image")
199
  run_btn.click(
200
  inference,
201
  inputs=[
@@ -213,7 +210,7 @@ Try our more powerful v2 here: https://qrcodemonster.art!
213
  gr.Examples(
214
  examples=[
215
  [
216
- "https://qrcodemonster.art",
217
  "Baroque rococo architecture, architectural photography, post apocalyptic New York, hyperrealism, [roots], hyperrealistic, octane render, cinematic, hyper detailed, 8K",
218
  "",
219
  7,
@@ -231,7 +228,7 @@ Try our more powerful v2 here: https://qrcodemonster.art!
231
  "Euler a",
232
  ],
233
  [
234
- "https://qrcodemonster.art",
235
  "3 cups of coffee with coffee beans around",
236
  "",
237
  7,
@@ -249,7 +246,7 @@ Try our more powerful v2 here: https://qrcodemonster.art!
249
  "Euler a",
250
  ],
251
  [
252
- "https://qrcodemonster.art",
253
  "A top view picture of a sandy beach, organic shapes, beautiful lighting, bumps and shadows, 8k, highly detailed",
254
  "sky, water, squares",
255
  7,
@@ -275,9 +272,9 @@ Try our more powerful v2 here: https://qrcodemonster.art!
275
  """
276
  ## Notes
277
 
278
- * The generated QR codes may not always be easily readable and may require adjusting the parameters.
279
  * The prompt affects the quality of the generated QR code.
280
- * The scan may work better if the phone is held further away from the screen.
281
 
282
  ## Parameters
283
 
 
77
  guidance_scale: float = 10.0,
78
  controlnet_conditioning_scale: float = 2.0,
79
  seed: int = -1,
80
+ sampler="Euler a",
81
  ):
82
  if prompt is None or prompt == "":
83
  raise gr.Error("Prompt is required")
 
99
  prompt=prompt,
100
  negative_prompt=negative_prompt,
101
  image=qrcode_image,
102
+ width=qrcode_image.width,
103
+ height=qrcode_image.height,
104
  guidance_scale=float(guidance_scale),
105
+ controlnet_conditioning_scale=float(controlnet_conditioning_scale),
 
106
  generator=generator,
107
  num_inference_steps=40,
108
  )
109
+ return out.images[0]
110
 
111
 
112
  css = """
 
166
  value=1.5,
167
  label="Controlnet Conditioning Scale",
168
  info="""Controls the readability/creativity of the QR code.
 
169
  High values: The generated QR code will be more readable.
170
  Low values: The generated QR code will be more creative.
171
  """
 
192
  with gr.Row():
193
  run_btn = gr.Button("Run")
194
  with gr.Column():
195
+ result_image = gr.Image(label="Result Image", elem_id="result_image")
 
196
  run_btn.click(
197
  inference,
198
  inputs=[
 
210
  gr.Examples(
211
  examples=[
212
  [
213
+ "test",
214
  "Baroque rococo architecture, architectural photography, post apocalyptic New York, hyperrealism, [roots], hyperrealistic, octane render, cinematic, hyper detailed, 8K",
215
  "",
216
  7,
 
228
  "Euler a",
229
  ],
230
  [
231
+ "test",
232
  "3 cups of coffee with coffee beans around",
233
  "",
234
  7,
 
246
  "Euler a",
247
  ],
248
  [
249
+ "test",
250
  "A top view picture of a sandy beach, organic shapes, beautiful lighting, bumps and shadows, 8k, highly detailed",
251
  "sky, water, squares",
252
  7,
 
272
  """
273
  ## Notes
274
 
275
+ * The generated QR codes may not always be easily readable and may require adjusting the parameters.
276
  * The prompt affects the quality of the generated QR code.
277
+ * The scan may work better if the phone is held further away from the screen, or if the page is zoomed out.
278
 
279
  ## Parameters
280