Meloo commited on
Commit
3e7576b
1 Parent(s): aeea542

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -116,7 +116,9 @@ def load_img(filename, norm=True):
116
 
117
 
118
  def inference(image, upscale, large_input_flag, color_fix):
119
- upscale = int(upscale) # convert type to int
 
 
120
  if upscale > 4:
121
  upscale = 4
122
  if 0 < upscale < 3:
@@ -216,7 +218,7 @@ demo = gr.Interface(
216
  fn=inference,
217
  inputs=[
218
  gr.Image(value="real_testdata/004.png", type="pil", label="Input"),
219
- gr.Number(minimum=2, maximum=4, label="Upscaling factor (up to 4)"),
220
  gr.Checkbox(value=False, label="Memory-efficient inference"),
221
  gr.Checkbox(value=False, label="Color correction"),
222
  ],
 
116
 
117
 
118
  def inference(image, upscale, large_input_flag, color_fix):
119
+ if upscale is None or not isinstance(upscale, (int, float)):
120
+ upscale = 2
121
+ upscale = int(upscale)
122
  if upscale > 4:
123
  upscale = 4
124
  if 0 < upscale < 3:
 
218
  fn=inference,
219
  inputs=[
220
  gr.Image(value="real_testdata/004.png", type="pil", label="Input"),
221
+ gr.Number(minimum=2, maximum=4, default=2, label="Upscaling factor (up to 4)"),
222
  gr.Checkbox(value=False, label="Memory-efficient inference"),
223
  gr.Checkbox(value=False, label="Color correction"),
224
  ],