fantos commited on
Commit
1e6f880
โ€ข
1 Parent(s): b66a115

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -22
app.py CHANGED
@@ -161,19 +161,19 @@ def infer(cond_in, image_in, prompt, inference_steps, guidance_scale, control_mo
161
  if cond_in is None:
162
  if image_in is not None:
163
  image_in = resize_img(load_image(image_in))
164
- if control_mode == "์บ๋‹ˆ":
165
  control_image = extract_canny(image_in)
166
- elif control_mode == "๊นŠ์ด":
167
  control_image = extract_depth(image_in)
168
- elif control_mode == "์˜คํ”ˆํฌ์ฆˆ":
169
  control_image = extract_openpose(image_in)
170
- elif control_mode == "๋ธ”๋Ÿฌ":
171
  control_image = apply_gaussian_blur(image_in)
172
- elif control_mode == "์ €ํ’ˆ์งˆ":
173
  control_image = add_gaussian_noise(image_in)
174
- elif control_mode == "๊ทธ๋ ˆ์ด์Šค์ผ€์ผ":
175
  control_image = convert_to_grayscale(image_in)
176
- elif control_mode == "ํƒ€์ผ":
177
  control_image = tile(image_in)
178
  else:
179
  control_image = resize_img(load_image(cond_in))
@@ -212,19 +212,21 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
212
  with gr.Column():
213
 
214
  with gr.Row(equal_height=True):
215
- cond_in = gr.Image(label="์ฒ˜๋ฆฌ๋œ ์ปจํŠธ๋กค ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ", sources=["upload"], type="filepath")
216
- image_in = gr.Image(label="์ฐธ์กฐ ์ด๋ฏธ์ง€์—์„œ ์กฐ๊ฑด ์ถ”์ถœ (์„ ํƒ์‚ฌํ•ญ)", sources=["upload"], type="filepath")
217
 
218
- prompt = gr.Textbox(label="ํ”„๋กฌํ”„ํŠธ", value="์ตœ๊ณ  ํ’ˆ์งˆ")
219
 
220
- with gr.Accordion("์ปจํŠธ๋กค๋„ท"):
221
  control_mode = gr.Radio(
222
- ["์บ๋‹ˆ", "๊นŠ์ด", "์˜คํ”ˆํฌ์ฆˆ", "๊ทธ๋ ˆ์ด์Šค์ผ€์ผ", "๋ธ”๋Ÿฌ", "ํƒ€์ผ", "์ €ํ’ˆ์งˆ"], label="๋ชจ๋“œ", value="๊ทธ๋ ˆ์ด์Šค์ผ€์ผ",
223
- info="์ปจํŠธ๋กค ๋ชจ๋“œ ์„ ํƒ, ๋ชจ๋“  ์ด๋ฏธ์ง€์— ์ ์šฉ๋ฉ๋‹ˆ๋‹ค"
 
 
224
  )
225
 
226
  control_strength = gr.Slider(
227
- label="์ปจํŠธ๋กค ๊ฐ•๋„",
228
  minimum=0,
229
  maximum=1.0,
230
  step=0.05,
@@ -232,25 +234,25 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
232
  )
233
 
234
  seed = gr.Slider(
235
- label="์‹œ๋“œ",
236
  minimum=0,
237
  maximum=MAX_SEED,
238
  step=1,
239
  value=42,
240
  )
241
- randomize_seed = gr.Checkbox(label="์‹œ๋“œ ๋ฌด์ž‘์œ„ํ™”", value=True)
242
 
243
- with gr.Accordion("๊ณ ๊ธ‰ ์„ค์ •", open=False):
244
  with gr.Column():
245
  with gr.Row():
246
- inference_steps = gr.Slider(label="์ถ”๋ก  ๋‹จ๊ณ„", minimum=1, maximum=50, step=1, value=24)
247
- guidance_scale = gr.Slider(label="๊ฐ€์ด๋˜์Šค ์Šค์ผ€์ผ", minimum=1.0, maximum=10.0, step=0.1, value=3.5)
248
 
249
- submit_btn = gr.Button("์ œ์ถœ")
250
 
251
  with gr.Column():
252
- result = gr.Image(label="๊ฒฐ๊ณผ")
253
- processed_cond = gr.Image(label="์ „์ฒ˜๋ฆฌ๋œ ์กฐ๊ฑด")
254
 
255
  submit_btn.click(
256
  fn=randomize_seed_fn,
 
161
  if cond_in is None:
162
  if image_in is not None:
163
  image_in = resize_img(load_image(image_in))
164
+ if control_mode == "Canny":
165
  control_image = extract_canny(image_in)
166
+ elif control_mode == "Depth":
167
  control_image = extract_depth(image_in)
168
+ elif control_mode == "OpenPose":
169
  control_image = extract_openpose(image_in)
170
+ elif control_mode == "Blur":
171
  control_image = apply_gaussian_blur(image_in)
172
+ elif control_mode == "LowQuality":
173
  control_image = add_gaussian_noise(image_in)
174
+ elif control_mode == "Grayscale":
175
  control_image = convert_to_grayscale(image_in)
176
+ elif control_mode == "Tile":
177
  control_image = tile(image_in)
178
  else:
179
  control_image = resize_img(load_image(cond_in))
 
212
  with gr.Column():
213
 
214
  with gr.Row(equal_height=True):
215
+ cond_in = gr.Image(label="Upload Processed Control Image", sources=["upload"], type="filepath")
216
+ image_in = gr.Image(label="Extract Condition from Reference Image (Optional)", sources=["upload"], type="filepath")
217
 
218
+ prompt = gr.Textbox(label="Prompt", value="Highest Quality")
219
 
220
+ with gr.Accordion("ControlNet"):
221
  control_mode = gr.Radio(
222
+ ["Canny", "Depth", "OpenPose", "Grayscale", "Blur", "Tile", "LowQuality"],
223
+ label="Mode",
224
+ value="Grayscale",
225
+ info="Select control mode, applies to all images"
226
  )
227
 
228
  control_strength = gr.Slider(
229
+ label="Control Strength",
230
  minimum=0,
231
  maximum=1.0,
232
  step=0.05,
 
234
  )
235
 
236
  seed = gr.Slider(
237
+ label="Seed",
238
  minimum=0,
239
  maximum=MAX_SEED,
240
  step=1,
241
  value=42,
242
  )
243
+ randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
244
 
245
+ with gr.Accordion("Advanced Settings", open=False):
246
  with gr.Column():
247
  with gr.Row():
248
+ inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=24)
249
+ guidance_scale = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=10.0, step=0.1, value=3.5)
250
 
251
+ submit_btn = gr.Button("Submit")
252
 
253
  with gr.Column():
254
+ result = gr.Image(label="Result")
255
+ processed_cond = gr.Image(label="Preprocessed Condition")
256
 
257
  submit_btn.click(
258
  fn=randomize_seed_fn,