GroundingDINO/groundingdino/datasets/transforms.py
CHANGED
|
@@ -10,8 +10,8 @@ import torch
|
|
| 10 |
import torchvision.transforms as T
|
| 11 |
import torchvision.transforms.functional as F
|
| 12 |
|
| 13 |
-
from groundingdino.util.box_ops import box_xyxy_to_cxcywh
|
| 14 |
-
from groundingdino.util.misc import interpolate
|
| 15 |
|
| 16 |
|
| 17 |
def crop(image, target, region):
|
|
|
|
| 10 |
import torchvision.transforms as T
|
| 11 |
import torchvision.transforms.functional as F
|
| 12 |
|
| 13 |
+
from .groundingdino.util.box_ops import box_xyxy_to_cxcywh
|
| 14 |
+
from .groundingdino.util.misc import interpolate
|
| 15 |
|
| 16 |
|
| 17 |
def crop(image, target, region):
|
__pycache__/handler.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/handler.cpython-310.pyc and b/__pycache__/handler.cpython-310.pyc differ
|
|
|
__pycache__/test.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/test.cpython-310.pyc and b/__pycache__/test.cpython-310.pyc differ
|
|
|
handler.py
CHANGED
|
@@ -1,16 +1,19 @@
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
| 3 |
import torch
|
| 4 |
-
from test import just_get_sd_mask
|
| 5 |
import requests
|
| 6 |
from PIL import Image
|
| 7 |
from io import BytesIO
|
| 8 |
|
|
|
|
|
|
|
| 9 |
print(os.listdir('/usr/local/'))
|
| 10 |
print(torch.version.cuda)
|
| 11 |
|
| 12 |
class EndpointHandler():
|
| 13 |
def __init__(self, path="."):
|
|
|
|
|
|
|
| 14 |
is_production = True
|
| 15 |
|
| 16 |
if False:
|
|
@@ -42,6 +45,9 @@ class EndpointHandler():
|
|
| 42 |
subprocess.run(["pip", "install", "-r", "./recognize-anything/requirements.txt"])
|
| 43 |
subprocess.run(["pip", "install", "-e", "./recognize-anything/"])
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
def __call__(self, data):
|
| 46 |
mask_pil = just_get_sd_mask(Image.open("assets/demo1.jpg"), "bear", 10)
|
| 47 |
|
|
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
| 3 |
import torch
|
|
|
|
| 4 |
import requests
|
| 5 |
from PIL import Image
|
| 6 |
from io import BytesIO
|
| 7 |
|
| 8 |
+
just_get_sd_mask_function = None
|
| 9 |
+
|
| 10 |
print(os.listdir('/usr/local/'))
|
| 11 |
print(torch.version.cuda)
|
| 12 |
|
| 13 |
class EndpointHandler():
|
| 14 |
def __init__(self, path="."):
|
| 15 |
+
global just_get_sd_mask_function
|
| 16 |
+
|
| 17 |
is_production = True
|
| 18 |
|
| 19 |
if False:
|
|
|
|
| 45 |
subprocess.run(["pip", "install", "-r", "./recognize-anything/requirements.txt"])
|
| 46 |
subprocess.run(["pip", "install", "-e", "./recognize-anything/"])
|
| 47 |
|
| 48 |
+
from test import just_get_sd_mask
|
| 49 |
+
just_get_sd_mask_function = just_get_sd_mask
|
| 50 |
+
|
| 51 |
def __call__(self, data):
|
| 52 |
mask_pil = just_get_sd_mask(Image.open("assets/demo1.jpg"), "bear", 10)
|
| 53 |
|