LanHarmony commited on
Commit
e28d0be
1 Parent(s): ceebd56

support GroundingDINO and segment-anything

Browse files
Files changed (1) hide show
  1. visual_foundation_models.py +6 -1
visual_foundation_models.py CHANGED
@@ -14,7 +14,6 @@ import cv2
14
  import uuid
15
  from PIL import Image, ImageOps
16
  import numpy as np
17
- from pytorch_lightning import seed_everything
18
  import math
19
 
20
  from langchain.llms.openai import OpenAI
@@ -112,6 +111,12 @@ def get_new_image_name(org_img_name, func_name="update"):
112
  new_file_name = '{}_{}_{}_{}.png'.format(this_new_uuid, func_name, recent_prev_file_name, most_org_file_name)
113
  return os.path.join(head, new_file_name)
114
 
 
 
 
 
 
 
115
 
116
  class InstructPix2Pix:
117
  def __init__(self, device):
 
14
  import uuid
15
  from PIL import Image, ImageOps
16
  import numpy as np
 
17
  import math
18
 
19
  from langchain.llms.openai import OpenAI
 
111
  new_file_name = '{}_{}_{}_{}.png'.format(this_new_uuid, func_name, recent_prev_file_name, most_org_file_name)
112
  return os.path.join(head, new_file_name)
113
 
114
+ def seed_everything(seed):
115
+ random.seed(seed)
116
+ np.random.seed(seed)
117
+ torch.manual_seed(seed)
118
+ torch.cuda.manual_seed_all(seed)
119
+ return seed
120
 
121
  class InstructPix2Pix:
122
  def __init__(self, device):