stzhao commited on
Commit
a826a23
·
verified ·
1 Parent(s): 4920a3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -70,7 +70,7 @@ Below is the simple caption of an image with text. Please deduce the detailed de
70
 
71
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
72
  enhanced_caption = response.split("</think>", -1)[-1].strip(" ").strip("\n")
73
-
74
  torch.cuda.empty_cache()
75
 
76
  return combined_caption, enhanced_caption
@@ -98,7 +98,7 @@ def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
98
  generator=generator,
99
  system_prompt="You are an assistant designed to generate superior images with the superior degree of image-text alignment based on textual prompts or user prompts.",
100
  ).images[0]
101
-
102
  torch.cuda.empty_cache()
103
 
104
  return image
 
70
 
71
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
72
  enhanced_caption = response.split("</think>", -1)[-1].strip(" ").strip("\n")
73
+ model.to("cpu")
74
  torch.cuda.empty_cache()
75
 
76
  return combined_caption, enhanced_caption
 
98
  generator=generator,
99
  system_prompt="You are an assistant designed to generate superior images with the superior degree of image-text alignment based on textual prompts or user prompts.",
100
  ).images[0]
101
+ pipe.to("cpu")
102
  torch.cuda.empty_cache()
103
 
104
  return image