Barak1 commited on
Commit
1528d83
·
1 Parent(s): 3a410f0

minor bug fix

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -110,15 +110,15 @@ with gr.Blocks(css="style.css") as demo:
110
  inversion_max_step=inversion_max_step)
111
  if device == 'cuda':
112
  torch.cuda.empty_cache()
113
- pipe_inversion = pipe_inversion.to(device)
114
  # if image_editor is not None:
115
  # image_editor = image_editor.to('cpu')
116
 
117
- inversion_state = ImageEditorDemo.invert(pipe_inversion, input_image, description_prompt, config,
118
  [rnri_iterations, rnri_alpha, rnri_lr], device)
119
  if device == 'cuda':
120
  torch.cuda.empty_cache()
121
- pipe_inversion = pipe_inversion.to('cpu')
122
  return inversion_state, "Input has set!"
123
 
124
 
@@ -144,12 +144,10 @@ with gr.Blocks(css="style.css") as demo:
144
 
145
  if device == 'cuda':
146
  torch.cuda.empty_cache()
147
- pipe_inference = pipe_inference.to(device)
148
- image = ImageEditorDemo.edit(pipe_inference, target_prompt, inversion_state['latent'], inversion_state['noise'],
149
  inversion_state['cfg'], inversion_state['cfg'].edit_guidance_scale)
150
 
151
  if device == 'cuda':
152
- pipe_inference = pipe_inference.to('cpu')
153
  torch.cuda.empty_cache()
154
  return image
155
 
 
110
  inversion_max_step=inversion_max_step)
111
  if device == 'cuda':
112
  torch.cuda.empty_cache()
113
+ # pipe_inversion = pipe_inversion.to(device)
114
  # if image_editor is not None:
115
  # image_editor = image_editor.to('cpu')
116
 
117
+ inversion_state = ImageEditorDemo.invert(pipe_inversion.to(device), input_image, description_prompt, config,
118
  [rnri_iterations, rnri_alpha, rnri_lr], device)
119
  if device == 'cuda':
120
  torch.cuda.empty_cache()
121
+ # pipe_inversion = pipe_inversion.to('cpu')
122
  return inversion_state, "Input has set!"
123
 
124
 
 
144
 
145
  if device == 'cuda':
146
  torch.cuda.empty_cache()
147
+ image = ImageEditorDemo.edit(pipe_inference.to(device), target_prompt, inversion_state['latent'], inversion_state['noise'],
 
148
  inversion_state['cfg'], inversion_state['cfg'].edit_guidance_scale)
149
 
150
  if device == 'cuda':
 
151
  torch.cuda.empty_cache()
152
  return image
153