import os from fengxai.SelfSupervised import SelfSupervised def imagePrediction(imageFile, funcCallback): if not os.path.exists("weights/sam_vit_h_4b8939.pth") \ and not os.path.exists("weights/groundingdino_swint_ogc.pth"): cmd = "pip install git+https://github.com/IDEA-Research/GroundingDINO.git" os.system(cmd) cmd = """ mkdir weights \ && cd weights \ && wget -q https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth \ && wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth \ && cd .. """ os.system(cmd) selfSupervised = SelfSupervised() funcCallback(selfSupervised.imagePredict(imageFile))