Fabrice-TIERCELIN commited on
Commit
eefe9fb
·
verified ·
1 Parent(s): c65f1da

More lines for descriptions

Browse files
Files changed (1) hide show
  1. gradio_demo.py +12 -9
gradio_demo.py CHANGED
@@ -30,7 +30,7 @@ parser.add_argument("--no_llava", action='store_true', default=True)#False
30
  parser.add_argument("--use_image_slider", action='store_true', default=False)
31
  parser.add_argument("--log_history", action='store_true', default=False)
32
  parser.add_argument("--loading_half_params", action='store_true', default=True)#False
33
- parser.add_argument("--use_tile_vae", action='store_true', default=True)#False
34
  parser.add_argument("--encoder_tile_size", type=int, default=512)
35
  parser.add_argument("--decoder_tile_size", type=int, default=64)
36
  parser.add_argument("--load_8bit_llava", action='store_true', default=False)
@@ -201,6 +201,7 @@ def load_and_reset(param_setting):
201
  spt_linear_CFG = default_setting.spt_linear_CFG_Fidelity
202
  else:
203
  raise NotImplementedError
 
204
  print('End load_and_reset')
205
  return edm_steps, s_cfg, s_stage2, s_stage1, s_churn, s_noise, a_prompt, n_prompt, color_fix_type, linear_CFG, \
206
  linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2
@@ -263,7 +264,7 @@ with gr.Blocks(title='SUPIR') as interface:
263
  with gr.Column():
264
  gr.Markdown("<center>Pre-denoising Output</center>")
265
  denoise_image = gr.Image(type="numpy", elem_id="image-s1", height=400, width=400)
266
- prompt = gr.Textbox(label="Image description", value="", placeholder="A person, walking, in a town, Summer, photorealistic")
267
 
268
  with gr.Accordion("Pre-denoising options", open=False):
269
  gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
@@ -271,10 +272,10 @@ with gr.Blocks(title='SUPIR') as interface:
271
  with gr.Accordion("LLaVA options", open=False):
272
  temperature = gr.Slider(label="Temperature", info = "lower=Always similar, higher=More creative", minimum=0., maximum=1.0, value=0.2, step=0.1)
273
  top_p = gr.Slider(label="Top P", info = "Percent of tokens shortlisted", minimum=0., maximum=1.0, value=0.7, step=0.1)
274
- qs = gr.Textbox(label="Question", info="Describe the image and its style in a very detailed manner", placeholder="The image is a realistic photography, not an art painting.")
275
 
276
  with gr.Accordion("Restoring options", open=False):
277
- num_samples = gr.Slider(label="Num Samples", info="Number of generated results; I discourage to increase because the process is limited to 2 min", minimum=1, maximum=4 if not args.use_image_slider else 1
278
  , value=1, step=1)
279
  upscale = gr.Slider(label="Upscale", info="The resolution increase factor", minimum=1, maximum=8, value=1, step=1)
280
  edm_steps = gr.Slider(label="Steps", info="lower=faster, higher=more details", minimum=1, maximum=200, value=default_setting.edm_steps if torch.cuda.device_count() > 0 else 1, step=1)
@@ -290,13 +291,15 @@ with gr.Blocks(title='SUPIR') as interface:
290
  value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
291
  'camera, hyper detailed photo - realistic maximum detail, 32k, Color '
292
  'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
293
- 'hyper sharpness, perfect without deformations.')
 
294
  n_prompt = gr.Textbox(label="Default Negative Prompt",
295
  info="List what the image does NOT represent",
296
  value='painting, oil painting, illustration, drawing, art, sketch, anime, '
297
  'cartoon, CG Style, 3D render, unreal engine, blurring, bokeh, ugly, dirty, messy, '
298
  'worst quality, low quality, frames, watermark, signature, jpeg artifacts, '
299
- 'deformed, lowres, over-smooth')
 
300
  with gr.Row():
301
  with gr.Column():
302
  linear_CFG = gr.Checkbox(label="Linear CFG", value=True)
@@ -314,10 +317,10 @@ with gr.Blocks(title='SUPIR') as interface:
314
  ae_dtype = gr.Radio(['fp32', 'bf16'], label="Auto-Encoder Data Type", value="bf16",
315
  interactive=True)
316
  with gr.Column():
317
- color_fix_type = gr.Radio(["None", "AdaIn", "Wavelet"], label="Color-Fix Type", value="Wavelet",
318
  interactive=True)
319
  with gr.Column():
320
- model_select = gr.Radio(["v0-Q", "v0-F"], label="Model Selection", value="v0-Q",
321
  interactive=True)
322
 
323
  with gr.Column():
@@ -330,7 +333,7 @@ with gr.Blocks(title='SUPIR') as interface:
330
  with gr.Column():
331
  denoise_button = gr.Button(value="Pre-denoise (KO)")
332
  with gr.Column():
333
- llave_button = gr.Button(value="Auto-generate description (LlaVa)")
334
  with gr.Column():
335
  diffusion_button = gr.Button(value="🚀 Restore", variant = "primary")
336
  with gr.Row():
 
30
  parser.add_argument("--use_image_slider", action='store_true', default=False)
31
  parser.add_argument("--log_history", action='store_true', default=False)
32
  parser.add_argument("--loading_half_params", action='store_true', default=True)#False
33
+ parser.add_argument("--use_tile_vae", action='store_true', default=False)#False
34
  parser.add_argument("--encoder_tile_size", type=int, default=512)
35
  parser.add_argument("--decoder_tile_size", type=int, default=64)
36
  parser.add_argument("--load_8bit_llava", action='store_true', default=False)
 
201
  spt_linear_CFG = default_setting.spt_linear_CFG_Fidelity
202
  else:
203
  raise NotImplementedError
204
+ gr.Info('The parameters are reset.')
205
  print('End load_and_reset')
206
  return edm_steps, s_cfg, s_stage2, s_stage1, s_churn, s_noise, a_prompt, n_prompt, color_fix_type, linear_CFG, \
207
  linear_s_stage2, spt_linear_CFG, spt_linear_s_stage2
 
264
  with gr.Column():
265
  gr.Markdown("<center>Pre-denoising Output</center>")
266
  denoise_image = gr.Image(type="numpy", elem_id="image-s1", height=400, width=400)
267
+ prompt = gr.Textbox(label="Image description", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3)
268
 
269
  with gr.Accordion("Pre-denoising options", open=False):
270
  gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
 
272
  with gr.Accordion("LLaVA options", open=False):
273
  temperature = gr.Slider(label="Temperature", info = "lower=Always similar, higher=More creative", minimum=0., maximum=1.0, value=0.2, step=0.1)
274
  top_p = gr.Slider(label="Top P", info = "Percent of tokens shortlisted", minimum=0., maximum=1.0, value=0.7, step=0.1)
275
+ qs = gr.Textbox(label="Question", info="Describe the image and its style in a very detailed manner", placeholder="The image is a realistic photography, not an art painting.", lines=3)
276
 
277
  with gr.Accordion("Restoring options", open=False):
278
+ num_samples = gr.Slider(label="Num Samples", info="Number of generated results; I discourage to increase because the process is limited to 3 min", minimum=1, maximum=4 if not args.use_image_slider else 1
279
  , value=1, step=1)
280
  upscale = gr.Slider(label="Upscale", info="The resolution increase factor", minimum=1, maximum=8, value=1, step=1)
281
  edm_steps = gr.Slider(label="Steps", info="lower=faster, higher=more details", minimum=1, maximum=200, value=default_setting.edm_steps if torch.cuda.device_count() > 0 else 1, step=1)
 
291
  value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
292
  'camera, hyper detailed photo - realistic maximum detail, 32k, Color '
293
  'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
294
+ 'hyper sharpness, perfect without deformations.',
295
+ lines=3)
296
  n_prompt = gr.Textbox(label="Default Negative Prompt",
297
  info="List what the image does NOT represent",
298
  value='painting, oil painting, illustration, drawing, art, sketch, anime, '
299
  'cartoon, CG Style, 3D render, unreal engine, blurring, bokeh, ugly, dirty, messy, '
300
  'worst quality, low quality, frames, watermark, signature, jpeg artifacts, '
301
+ 'deformed, lowres, over-smooth',
302
+ lines=3)
303
  with gr.Row():
304
  with gr.Column():
305
  linear_CFG = gr.Checkbox(label="Linear CFG", value=True)
 
317
  ae_dtype = gr.Radio(['fp32', 'bf16'], label="Auto-Encoder Data Type", value="bf16",
318
  interactive=True)
319
  with gr.Column():
320
+ color_fix_type = gr.Radio(["None", "AdaIn", "Wavelet"], label="Color-Fix Type", info="AdaIn=Adaptive Instance Normalization, Wavelet=For JPEG artifacts", value="Wavelet",
321
  interactive=True)
322
  with gr.Column():
323
+ model_select = gr.Radio(["v0-Q", "v0-F"], label="Model Selection", info="Q=Quality, F=Fidelity", value="v0-Q",
324
  interactive=True)
325
 
326
  with gr.Column():
 
333
  with gr.Column():
334
  denoise_button = gr.Button(value="Pre-denoise (KO)")
335
  with gr.Column():
336
+ llave_button = gr.Button(value="Generate description by LlaVa (KO)")
337
  with gr.Column():
338
  diffusion_button = gr.Button(value="🚀 Restore", variant = "primary")
339
  with gr.Row():