Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ processor = CLIPSegProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
|
|
23 |
clipseg_model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
24 |
|
25 |
# Load LAMA model
|
26 |
-
|
27 |
|
28 |
def process_image(image, prompt):
|
29 |
# Generate mask with CLIPSeg
|
@@ -43,8 +43,7 @@ def process_image(image, prompt):
|
|
43 |
# input_dict = {"image": image, "mask": mask_image}
|
44 |
# imageio.imwrite("./data/data_mask.png", input_dict["mask"])
|
45 |
imageio.imwrite("./data/data_mask.png", mask_image)
|
46 |
-
os.system('python predict.py
|
47 |
-
# # inpainted_image = lama_model.inference(data=input_dict)["data"][0]
|
48 |
inpainted_image = "./dataout/data_mask.png"
|
49 |
|
50 |
# inpainted_image = Image.new('RGB', (image.shape[1], image.shape[0]), (0, 0, 0))
|
|
|
23 |
clipseg_model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
|
24 |
|
25 |
# Load LAMA model
|
26 |
+
model = hub.Module(name='U2Net')
|
27 |
|
28 |
def process_image(image, prompt):
|
29 |
# Generate mask with CLIPSeg
|
|
|
43 |
# input_dict = {"image": image, "mask": mask_image}
|
44 |
# imageio.imwrite("./data/data_mask.png", input_dict["mask"])
|
45 |
imageio.imwrite("./data/data_mask.png", mask_image)
|
46 |
+
os.system('python predict.py model.path=/home/user/app/ indir=/home/user/app/data/ outdir=/home/user/app/dataout/ device=cpu')
|
|
|
47 |
inpainted_image = "./dataout/data_mask.png"
|
48 |
|
49 |
# inpainted_image = Image.new('RGB', (image.shape[1], image.shape[0]), (0, 0, 0))
|