Spaces:
Runtime error
Runtime error
liuyizhang
commited on
Commit
•
32f6715
1
Parent(s):
63057ef
update app.py
Browse files
app.py
CHANGED
@@ -39,13 +39,15 @@ import cv2
|
|
39 |
import numpy as np
|
40 |
import matplotlib.pyplot as plt
|
41 |
|
42 |
-
|
|
|
|
|
|
|
43 |
try:
|
44 |
from lama_cleaner.model_manager import ModelManager
|
45 |
-
from lama_cleaner.schema import Config as lama_Config
|
46 |
-
lama_cleaner_enable = True
|
47 |
except Exception as e:
|
48 |
-
|
49 |
|
50 |
# segment anything
|
51 |
from segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator
|
@@ -75,18 +77,17 @@ if lama_cleaner_enable:
|
|
75 |
import ast
|
76 |
from kosmos_utils import *
|
77 |
|
78 |
-
ram_enable = True
|
79 |
-
kosmos_enable = True
|
80 |
-
|
81 |
config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
82 |
ckpt_repo_id = "ShilongLiu/GroundingDINO"
|
83 |
ckpt_filenmae = "groundingdino_swint_ogc.pth"
|
84 |
sam_checkpoint = './sam_vit_h_4b8939.pth'
|
85 |
output_dir = "outputs"
|
|
|
86 |
if os.environ.get('IS_MY_DEBUG') is None:
|
87 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
88 |
else:
|
89 |
device = 'cpu'
|
|
|
90 |
|
91 |
os.makedirs(output_dir, exist_ok=True)
|
92 |
groundingdino_model = None
|
|
|
39 |
import numpy as np
|
40 |
import matplotlib.pyplot as plt
|
41 |
|
42 |
+
ram_enable = True
|
43 |
+
kosmos_enable = True
|
44 |
+
|
45 |
+
lama_cleaner_enable = True
|
46 |
try:
|
47 |
from lama_cleaner.model_manager import ModelManager
|
48 |
+
from lama_cleaner.schema import Config as lama_Config
|
|
|
49 |
except Exception as e:
|
50 |
+
lama_cleaner_enable = False
|
51 |
|
52 |
# segment anything
|
53 |
from segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator
|
|
|
77 |
import ast
|
78 |
from kosmos_utils import *
|
79 |
|
|
|
|
|
|
|
80 |
config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
81 |
ckpt_repo_id = "ShilongLiu/GroundingDINO"
|
82 |
ckpt_filenmae = "groundingdino_swint_ogc.pth"
|
83 |
sam_checkpoint = './sam_vit_h_4b8939.pth'
|
84 |
output_dir = "outputs"
|
85 |
+
|
86 |
if os.environ.get('IS_MY_DEBUG') is None:
|
87 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
88 |
else:
|
89 |
device = 'cpu'
|
90 |
+
kosmos_enable = False
|
91 |
|
92 |
os.makedirs(output_dir, exist_ok=True)
|
93 |
groundingdino_model = None
|