unnati026 commited on
Commit
dd066d5
·
1 Parent(s): 2c4ea77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -70,13 +70,13 @@ def get_loss_and_gradient(model, inputs, total_variation_weight=0):
70
  def run_gradient_ascent(model, inputs, progress_bar, epochs=1, steps_per_epoch=1, weight=0.05, total_variation_weight=0):
71
  img = tf.convert_to_tensor(inputs)
72
  for i in range(epochs):
73
- for _ in range(steps_per_epoch):
74
  _, grads = get_loss_and_gradient(model, img, total_variation_weight)
75
  img = img + grads * weight
76
  img = tf.clip_by_value(img, -1.0, 1.0)
77
 
78
  # Update progress bar
79
- progress_value = ((epoch * steps_per_epoch) + step) / (epochs * steps_per_epoch)
80
  progress_bar.progress(progress_value)
81
 
82
  return img.numpy(), progress_bar
 
70
  def run_gradient_ascent(model, inputs, progress_bar, epochs=1, steps_per_epoch=1, weight=0.05, total_variation_weight=0):
71
  img = tf.convert_to_tensor(inputs)
72
  for i in range(epochs):
73
+ for step in range(steps_per_epoch):
74
  _, grads = get_loss_and_gradient(model, img, total_variation_weight)
75
  img = img + grads * weight
76
  img = tf.clip_by_value(img, -1.0, 1.0)
77
 
78
  # Update progress bar
79
+ progress_value = ((i * steps_per_epoch) + step) / (epochs * steps_per_epoch)
80
  progress_bar.progress(progress_value)
81
 
82
  return img.numpy(), progress_bar