Lisandro commited on
Commit
5168bd5
·
1 Parent(s): 863a8cc

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

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -5,7 +5,7 @@ client = InferenceClient()
5
  from gradio_imageslider import ImageSlider
6
 
7
 
8
- def refine_image(image, prompt, negative_prompt, num_inference_steps, guidance_scale, seed, strength):
9
  refined_image = client.image_to_image(
10
  image,
11
  prompt=prompt,
@@ -13,7 +13,7 @@ def refine_image(image, prompt, negative_prompt, num_inference_steps, guidance_s
13
  num_inference_steps=num_inference_steps,
14
  guidance_scale=guidance_scale,
15
  seed=seed,
16
- model="stabilityai/stable-diffusion-xl-refiner-1.0",
17
  strength=strength
18
  )
19
  return [image, refined_image]
@@ -23,6 +23,7 @@ with gr.Blocks() as demo:
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(
@@ -60,7 +61,7 @@ with gr.Blocks() as demo:
60
 
61
  refine_btn.click(
62
  refine_image,
63
- inputs=[image, prompt, negative_prompt, num_inference_steps, guidance_scale, seed, strength],
64
  outputs=output
65
  )
66
 
 
5
  from gradio_imageslider import ImageSlider
6
 
7
 
8
+ def refine_image(image, model ,prompt, negative_prompt, num_inference_steps, guidance_scale, seed, strength):
9
  refined_image = client.image_to_image(
10
  image,
11
  prompt=prompt,
 
13
  num_inference_steps=num_inference_steps,
14
  guidance_scale=guidance_scale,
15
  seed=seed,
16
+ model=model,
17
  strength=strength
18
  )
19
  return [image, refined_image]
 
23
  with gr.Column():
24
  image = gr.Image(type="filepath")
25
  with gr.Accordion("Advanced Options", open=False):
26
+ model = gr.Textbox(label="Model", default="stabilityai/stable-diffusion-xl-refiner-1.0")
27
  prompt = gr.Textbox(lines=3, label="Prompt")
28
  negative_prompt = gr.Textbox(lines=3, label="Negative Prompt")
29
  strength = gr.Slider(
 
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