JOY-Huang commited on
Commit
1f967a0
1 Parent(s): aa79e9e

gr.Image bug fixed

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -139,6 +139,7 @@ def instantir_restore(
139
  preview_start = preview_start / steps
140
  elif preview_start > 1.0:
141
  preview_start = preview_start / steps
 
142
  lq = [resize_img(lq.convert("RGB"), size=(width, height))]
143
  generator = torch.Generator(device=device).manual_seed(seed)
144
  timesteps = [
@@ -193,7 +194,7 @@ with gr.Blocks() as demo:
193
  3. Click `InstantIR magic!`.
194
  """)
195
  with gr.Row():
196
- lq_img = gr.Image(label="Low-quality image", type="pil")
197
  with gr.Column():
198
  with gr.Row():
199
  steps = gr.Number(label="Steps", value=30, step=1)
@@ -205,7 +206,7 @@ with gr.Blocks() as demo:
205
  # guidance_start = gr.Slider(label="Guidance Start", value=1.0, minimum=0.0, maximum=1.0, step=0.05)
206
  guidance_end = gr.Slider(label="Start Free Rendering", value=30, minimum=0, maximum=30, step=1)
207
  preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
208
- prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="")
209
  mode = gr.Checkbox(label="Creative Restoration", value=False)
210
  with gr.Row():
211
  with gr.Row():
@@ -213,8 +214,8 @@ with gr.Blocks() as demo:
213
  clear_btn = gr.ClearButton()
214
  index = gr.Slider(label="Restoration Previews", value=29, minimum=0, maximum=29, step=1)
215
  with gr.Row():
216
- output = gr.Image(label="InstantIR restored", type="pil")
217
- preview = gr.Image(label="Preview", type="pil")
218
  pipe_out = gr.Gallery(visible=False)
219
  clear_btn.add([lq_img, output, preview])
220
  restore_btn.click(
 
139
  preview_start = preview_start / steps
140
  elif preview_start > 1.0:
141
  preview_start = preview_start / steps
142
+ lq = Image.open(lq)
143
  lq = [resize_img(lq.convert("RGB"), size=(width, height))]
144
  generator = torch.Generator(device=device).manual_seed(seed)
145
  timesteps = [
 
194
  3. Click `InstantIR magic!`.
195
  """)
196
  with gr.Row():
197
+ lq_img = gr.Image(label="Low-quality image", type="filepath")
198
  with gr.Column():
199
  with gr.Row():
200
  steps = gr.Number(label="Steps", value=30, step=1)
 
206
  # guidance_start = gr.Slider(label="Guidance Start", value=1.0, minimum=0.0, maximum=1.0, step=0.05)
207
  guidance_end = gr.Slider(label="Start Free Rendering", value=30, minimum=0, maximum=30, step=1)
208
  preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
209
+ prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="", value="")
210
  mode = gr.Checkbox(label="Creative Restoration", value=False)
211
  with gr.Row():
212
  with gr.Row():
 
214
  clear_btn = gr.ClearButton()
215
  index = gr.Slider(label="Restoration Previews", value=29, minimum=0, maximum=29, step=1)
216
  with gr.Row():
217
+ output = gr.Image(label="InstantIR restored", type="filepath")
218
+ preview = gr.Image(label="Preview", type="filepath")
219
  pipe_out = gr.Gallery(visible=False)
220
  clear_btn.add([lq_img, output, preview])
221
  restore_btn.click(