Lisandro commited on
Commit
a4cf9b8
·
1 Parent(s): 90d9148

feat: Mejorar opciones avanzadas de refinamiento de imágenes en app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -21,32 +21,32 @@ def refine_image(image, model ,prompt, negative_prompt, num_inference_steps, gui
21
  with gr.Blocks() as demo:
22
  with gr.Row():
23
  with gr.Column():
24
- image = gr.Image(type="filepath")
25
  with gr.Accordion("Advanced Options", open=False):
26
- prompt = gr.Textbox(lines=3, label="Prompt")
27
- negative_prompt = gr.Textbox(lines=3, label="Negative Prompt")
28
- strength = gr.Slider(
29
  label="Strength",
30
  minimum=0,
31
  maximum=300,
32
  step=0.01,
33
  value=1
34
  )
35
- num_inference_steps = gr.Slider(
36
  label="Inference steps",
37
  minimum=3,
38
  maximum=300,
39
  step=1,
40
  value=25
41
  )
42
- guidance_scale = gr.Slider(
43
  label="Guidance scale",
44
  minimum=0.0,
45
  maximum=50.0,
46
  step=0.1,
47
  value=12
48
  )
49
- seed = gr.Slider(
50
  label="Seed",
51
  info="-1 denotes a random seed",
52
  minimum=-1,
@@ -54,15 +54,15 @@ with gr.Blocks() as demo:
54
  step=1,
55
  value=-1
56
  )
57
- model = gr.Textbox(label="Model", value="stabilityai/stable-diffusion-xl-refiner-1.0")
58
- refine_btn = gr.Button("Refine")
59
  with gr.Column():
60
- output = ImageSlider(label="Before / After")
61
 
62
- refine_btn.click(
63
  refine_image,
64
- inputs=[image, model, prompt, negative_prompt, num_inference_steps, guidance_scale, seed, strength],
65
- outputs=output
66
  )
67
 
68
  demo.launch(show_error=True)
 
21
  with gr.Blocks() as demo:
22
  with gr.Row():
23
  with gr.Column():
24
+ refiner_image = gr.Image(type="filepath")
25
  with gr.Accordion("Advanced Options", open=False):
26
+ refiner_prompt = gr.Textbox(lines=3, label="Prompt")
27
+ refiner_negative_prompt = gr.Textbox(lines=3, label="Negative Prompt")
28
+ refiner_strength = gr.Slider(
29
  label="Strength",
30
  minimum=0,
31
  maximum=300,
32
  step=0.01,
33
  value=1
34
  )
35
+ refiner_num_inference_steps = gr.Slider(
36
  label="Inference steps",
37
  minimum=3,
38
  maximum=300,
39
  step=1,
40
  value=25
41
  )
42
+ refiner_guidance_scale = gr.Slider(
43
  label="Guidance scale",
44
  minimum=0.0,
45
  maximum=50.0,
46
  step=0.1,
47
  value=12
48
  )
49
+ refiner_seed = gr.Slider(
50
  label="Seed",
51
  info="-1 denotes a random seed",
52
  minimum=-1,
 
54
  step=1,
55
  value=-1
56
  )
57
+ refiner_model = gr.Textbox(label="Model", value="stabilityai/stable-diffusion-xl-refiner-1.0")
58
+ refiner_btn = gr.Button("Refine")
59
  with gr.Column():
60
+ refiner_output = ImageSlider(label="Before / After")
61
 
62
+ refiner_btn.click(
63
  refine_image,
64
+ inputs=[refiner_image, refiner_model, refiner_prompt, refiner_negative_prompt, refiner_num_inference_steps, refiner_guidance_scale, refiner_seed, refiner_strength],
65
+ outputs=refiner_output
66
  )
67
 
68
  demo.launch(show_error=True)