stzhao commited on
Commit
16ff32e
·
verified ·
1 Parent(s): c5b92f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -63,6 +63,8 @@ Below is the simple caption of an image with text. Please deduce the detailed de
63
 
64
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
65
  enhanced_caption = response.split("</think>", -1)[-1].strip(" ").strip("\n")
 
 
66
 
67
  return combined_caption, enhanced_caption
68
 
@@ -83,6 +85,8 @@ def generate_image(enhanced_caption, seed, num_inference_steps, guidance_scale):
83
  generator=generator,
84
  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.",
85
  ).images[0]
 
 
86
 
87
  return image
88
 
 
63
 
64
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
65
  enhanced_caption = response.split("</think>", -1)[-1].strip(" ").strip("\n")
66
+
67
+ torch.cuda.empty_cache()
68
 
69
  return combined_caption, enhanced_caption
70
 
 
85
  generator=generator,
86
  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.",
87
  ).images[0]
88
+
89
+ torch.cuda.empty_cache()
90
 
91
  return image
92