Spaces:
Sleeping
Sleeping
Kingtous
commited on
Commit
·
d04db90
1
Parent(s):
9b53dda
fix: spaces gpu
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
import torch
|
5 |
from PIL import Image
|
6 |
import numpy as np
|
@@ -12,9 +12,8 @@ print(zero.device) # <-- 'cpu' 🤔
|
|
12 |
lama: SimpleLama = SimpleLama(device=zero.device)
|
13 |
|
14 |
|
15 |
-
|
16 |
def lama_inpainting(image: np.ndarray, mask: np.ndarray) -> np.ndarray:
|
17 |
-
print(image.shape, mask.shape)
|
18 |
res = lama(
|
19 |
Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)).convert("RGB"),
|
20 |
Image.fromarray(cv2.cvtColor(mask, cv2.COLOR_BGR2RGB)).convert("L"),
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
import spaces
|
4 |
import torch
|
5 |
from PIL import Image
|
6 |
import numpy as np
|
|
|
12 |
lama: SimpleLama = SimpleLama(device=zero.device)
|
13 |
|
14 |
|
15 |
+
@spaces.GPU
|
16 |
def lama_inpainting(image: np.ndarray, mask: np.ndarray) -> np.ndarray:
|
|
|
17 |
res = lama(
|
18 |
Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)).convert("RGB"),
|
19 |
Image.fromarray(cv2.cvtColor(mask, cv2.COLOR_BGR2RGB)).convert("L"),
|