fffiloni commited on
Commit
845875d
1 Parent(s): b78b661

Update gradio_demo/app.py

Browse files
Files changed (1) hide show
  1. gradio_demo/app.py +8 -2
gradio_demo/app.py CHANGED
@@ -114,7 +114,7 @@ def dynamic_guidance_slider(sampling_steps):
114
  def show_final_preview(preview_row):
115
  return preview_row[-1][0]
116
 
117
- @spaces.GPU #[uncomment to use ZeroGPU]
118
  @torch.no_grad()
119
  def instantir_restore(
120
  lq, prompt="", steps=30, cfg_scale=7.0, guidance_end=1.0,
@@ -134,7 +134,13 @@ def instantir_restore(
134
  preview_start = preview_start / steps
135
  elif preview_start > 1.0:
136
  preview_start = preview_start / steps
137
- lq = [resize_img(lq.convert("RGB"), size=None)]
 
 
 
 
 
 
138
  generator = torch.Generator(device=device).manual_seed(seed)
139
  timesteps = [
140
  i * (1000//steps) + pipe.scheduler.config.steps_offset for i in range(0, steps)
 
114
  def show_final_preview(preview_row):
115
  return preview_row[-1][0]
116
 
117
+ @spaces.GPU(duration=70) #[uncomment to use ZeroGPU]
118
  @torch.no_grad()
119
  def instantir_restore(
120
  lq, prompt="", steps=30, cfg_scale=7.0, guidance_end=1.0,
 
134
  preview_start = preview_start / steps
135
  elif preview_start > 1.0:
136
  preview_start = preview_start / steps
137
+
138
+ w, h = lq.size
139
+ if w == h :
140
+ lq = [resize_img(lq.convert("RGB"), size=(width, heigth))]
141
+ else:
142
+ lq = [resize_img(lq.convert("RGB"), size=None)]
143
+
144
  generator = torch.Generator(device=device).manual_seed(seed)
145
  timesteps = [
146
  i * (1000//steps) + pipe.scheduler.config.steps_offset for i in range(0, steps)