gokaygokay commited on
Commit
a31c900
1 Parent(s): fe5b9c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -157,7 +157,7 @@ def create_hdr_effect(original_image, hdr):
157
  return Image.fromarray(cv2.cvtColor(hdr_image_8bit, cv2.COLOR_BGR2RGB))
158
 
159
  lazy_pipe = LazyLoadPipeline()
160
- lazy_pipe.load() # Load the pipeline outside of the GPU function
161
 
162
  def prepare_image(input_image, resolution, hdr):
163
  condition_image = resize_and_upscale(input_image, resolution)
@@ -193,7 +193,14 @@ def gradio_process_image(input_image, resolution, num_inference_steps, strength,
193
  print("Image processing completed successfully")
194
  return result
195
 
196
- # Gradio interface
 
 
 
 
 
 
 
197
  with gr.Blocks() as demo:
198
  gr.Markdown("# Image Enhancement with Stable Diffusion")
199
  with gr.Row():
@@ -203,9 +210,9 @@ with gr.Blocks() as demo:
203
  with gr.Column():
204
  output_image = gr.Image(type="pil", label="Enhanced Image")
205
  with gr.Accordion("Advanced Options", open=False):
206
- resolution = gr.Slider(minimum=512, maximum=2048, value=1024, step=64, label="Resolution")
207
  num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
208
- strength = gr.Slider(minimum=0, maximum=1, value=0.35, step=0.05, label="Strength")
209
  hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
210
  guidance_scale = gr.Slider(minimum=0, maximum=20, value=3, step=0.5, label="Guidance Scale")
211
 
 
157
  return Image.fromarray(cv2.cvtColor(hdr_image_8bit, cv2.COLOR_BGR2RGB))
158
 
159
  lazy_pipe = LazyLoadPipeline()
160
+ lazy_pipe.load()
161
 
162
  def prepare_image(input_image, resolution, hdr):
163
  condition_image = resize_and_upscale(input_image, resolution)
 
193
  print("Image processing completed successfully")
194
  return result
195
 
196
+ title = """<h1 align="center">Image Upscaler with Tile Controlnet</h1>
197
+ <p align="center">The main ideas come from</p>
198
+ <p><center>
199
+ <a href="https://github.com/philz1337x/clarity-upscaler" target="_blank">[philz1337x]</a>
200
+ <a href="https://github.com/BatouResearch/controlnet-tile-upscale" target="_blank">[Pau-Lozano]</a>
201
+ </center></p>
202
+ """
203
+
204
  with gr.Blocks() as demo:
205
  gr.Markdown("# Image Enhancement with Stable Diffusion")
206
  with gr.Row():
 
210
  with gr.Column():
211
  output_image = gr.Image(type="pil", label="Enhanced Image")
212
  with gr.Accordion("Advanced Options", open=False):
213
+ resolution = gr.Slider(minimum=256, maximum=2048, value=512, step=256, label="Resolution")
214
  num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
215
+ strength = gr.Slider(minimum=0, maximum=1, value=0.4, step=0.01, label="Strength")
216
  hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
217
  guidance_scale = gr.Slider(minimum=0, maximum=20, value=3, step=0.5, label="Guidance Scale")
218