lichorosario commited on
Commit
ca754a0
1 Parent(s): 0ec398b

feat: Ajustar app.py para mejorar la funcionalidad de redimensionamiento de imágenes

Browse files

Se han realizado cambios en el archivo app.py para mejorar la funcionalidad de redimensionamiento de imágenes. Se ha agregado la opción de factor de reducción para controlar el tamaño de las imágenes generadas. Esto permite a los usuarios ajustar el nivel de detalle de las imágenes generadas según sus necesidades.

Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -91,7 +91,11 @@ def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width
91
  raise gr.Error(e)
92
 
93
 
94
- new_result = result + (prompt, )
 
 
 
 
95
 
96
  return new_result
97
  except Exception as e:
@@ -281,12 +285,12 @@ with gr.Blocks(css=css) as demo:
281
  output_slider = ImageSlider(label="Before / After", type="numpy", show_download_button=False)
282
 
283
  with gr.Accordion("Advanced Options", open=False):
284
- upscale_reduce_factor = gr.Slider(minimum=1, maximum=10)
285
- upscale_resolution = gr.Slider(minimum=128, maximum=2048, value=1024, step=128, label="Resolution")
286
- upscale_num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
287
- upscale_strength = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label="Strength")
288
  upscale_hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
289
- upscale_guidance_scale = gr.Slider(minimum=0, maximum=20, value=6, step=0.5, label="Guidance Scale")
290
  upscale_controlnet_strength = gr.Slider(minimum=0.0, maximum=2.0, value=0.75, step=0.05, label="ControlNet Strength")
291
  upscale_scheduler_name = gr.Dropdown(
292
  choices=["DDIM", "DPM++ 3M SDE Karras", "DPM++ 3M Karras"],
@@ -295,8 +299,6 @@ with gr.Blocks(css=css) as demo:
295
  )
296
 
297
 
298
-
299
-
300
  selected_index = gr.State(None)
301
 
302
  submit_btn.click(
 
91
  raise gr.Error(e)
92
 
93
 
94
+ generated_image_path = result[0] # Esto puede necesitar ser ajustado basado en la estructura real de result
95
+ used_seed = result[1] # Esto puede necesitar ser ajustado basado en la estructura real de result
96
+ used_prompt = prompt # El prompt usado es simplemente el prompt procesado
97
+
98
+ return generated_image_path, used_seed, used_prompt
99
 
100
  return new_result
101
  except Exception as e:
 
285
  output_slider = ImageSlider(label="Before / After", type="numpy", show_download_button=False)
286
 
287
  with gr.Accordion("Advanced Options", open=False):
288
+ upscale_reduce_factor = gr.Slider(minimum=1, maximum=10, step=1, label="Reduce Factor", info="1/n")
289
+ upscale_resolution = gr.Slider(minimum=128, maximum=2048, value=1024, step=128, label="Resolution", info="Image width")
290
+ upscale_num_inference_steps = gr.Slider(minimum=1, maximum=150, value=50, step=1, label="Number of Inference Steps")
291
+ upscale_strength = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label="Strength", info="Higher values give more detail")
292
  upscale_hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
293
+ upscale_guidance_scale = gr.Slider(minimum=0, maximum=20, value=12, step=0.5, label="Guidance Scale")
294
  upscale_controlnet_strength = gr.Slider(minimum=0.0, maximum=2.0, value=0.75, step=0.05, label="ControlNet Strength")
295
  upscale_scheduler_name = gr.Dropdown(
296
  choices=["DDIM", "DPM++ 3M SDE Karras", "DPM++ 3M Karras"],
 
299
  )
300
 
301
 
 
 
302
  selected_index = gr.State(None)
303
 
304
  submit_btn.click(