Manjushri commited on
Commit
273b97c
1 Parent(s): 152838c

Update app.py

Browse files

Iterations slider was having no effect, this fixed that.

Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -95,7 +95,7 @@ def gradient_ascent_loop(img, iterations, learning_rate, max_loss=None):
95
  return img
96
 
97
 
98
- def process_image(img,iterations):
99
  original_img = preprocess_image(img)
100
  original_shape = original_img.shape[1:3]
101
 
@@ -111,7 +111,7 @@ def process_image(img,iterations):
111
  print("Processing octave %d with shape %s" % (i, shape))
112
  img = tf.image.resize(img, shape)
113
  img = gradient_ascent_loop(
114
- img, iterations=iterations, learning_rate=step, max_loss=max_loss
115
  )
116
  upscaled_shrunk_original_img = tf.image.resize(shrunk_original_img, shape)
117
  same_size_original = tf.image.resize(original_img, shape)
@@ -126,7 +126,7 @@ image = gr.inputs.Image()
126
  slider = gr.inputs.Slider(minimum=5, maximum=30, step=1, default=20, label="Number of ascent steps per scale")
127
  label = gr.outputs.Image()
128
 
129
- iface = gr.Interface(process_image,[image,slider],label,
130
  #outputs=[
131
  # gr.outputs.Textbox(label="Engine issue"),
132
  # gr.outputs.Textbox(label="Engine issue score")],
 
95
  return img
96
 
97
 
98
+ def process_image(img, slider):
99
  original_img = preprocess_image(img)
100
  original_shape = original_img.shape[1:3]
101
 
 
111
  print("Processing octave %d with shape %s" % (i, shape))
112
  img = tf.image.resize(img, shape)
113
  img = gradient_ascent_loop(
114
+ img, iterations=slider, learning_rate=step, max_loss=max_loss
115
  )
116
  upscaled_shrunk_original_img = tf.image.resize(shrunk_original_img, shape)
117
  same_size_original = tf.image.resize(original_img, shape)
 
126
  slider = gr.inputs.Slider(minimum=5, maximum=30, step=1, default=20, label="Number of ascent steps per scale")
127
  label = gr.outputs.Image()
128
 
129
+ iface = gr.Interface(process_image,[image, slider],label,
130
  #outputs=[
131
  # gr.outputs.Textbox(label="Engine issue"),
132
  # gr.outputs.Textbox(label="Engine issue score")],