Spaces:
Sleeping
Sleeping
abyildirim
commited on
Commit
·
eaab7c8
1
Parent(s):
9bfd721
model is moved to gpu
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def inference(image: np.ndarray, instruction: str, center_crop: bool):
|
|
29 |
raise gr.Error("Instruction should start with 'Remove the' !")
|
30 |
image = Image.fromarray(image)
|
31 |
cropped_image, image = utils.preprocess_image(image, center_crop=center_crop)
|
32 |
-
output_image = MODEL.inpaint(image, instruction, num_steps=
|
33 |
return cropped_image, output_image
|
34 |
|
35 |
if __name__ == "__main__":
|
@@ -58,7 +58,7 @@ if __name__ == "__main__":
|
|
58 |
model_state_dict = torch.load(args.checkpoint, map_location="cpu")["state_dict"]
|
59 |
MODEL.load_state_dict(model_state_dict)
|
60 |
MODEL.eval()
|
61 |
-
MODEL.to("
|
62 |
|
63 |
sample_image, sample_instruction, sample_step = constants.EXAMPLES[3]
|
64 |
|
|
|
29 |
raise gr.Error("Instruction should start with 'Remove the' !")
|
30 |
image = Image.fromarray(image)
|
31 |
cropped_image, image = utils.preprocess_image(image, center_crop=center_crop)
|
32 |
+
output_image = MODEL.inpaint(image, instruction, num_steps=100, device="cuda", return_pil=True, seed=0)
|
33 |
return cropped_image, output_image
|
34 |
|
35 |
if __name__ == "__main__":
|
|
|
58 |
model_state_dict = torch.load(args.checkpoint, map_location="cpu")["state_dict"]
|
59 |
MODEL.load_state_dict(model_state_dict)
|
60 |
MODEL.eval()
|
61 |
+
MODEL.to("cuda")
|
62 |
|
63 |
sample_image, sample_instruction, sample_step = constants.EXAMPLES[3]
|
64 |
|