liuyizhang commited on
Commit
f76c27b
1 Parent(s): b67365a

update app.py

Browse files
Files changed (2) hide show
  1. app.py +12 -8
  2. kosmos_utils.py +4 -4
app.py CHANGED
@@ -41,7 +41,8 @@ groundingdino_enable = True
41
  sam_enable = True
42
  inpainting_enable = True
43
  ram_enable = True
44
- lama_cleaner_enable = True
 
45
 
46
  kosmos_enable = True
47
 
@@ -50,11 +51,12 @@ if os.environ.get('IS_MY_DEBUG') is not None:
50
  inpainting_enable = False
51
  kosmos_enable = False
52
 
53
- try:
54
- from lama_cleaner.model_manager import ModelManager
55
- from lama_cleaner.schema import Config as lama_Config
56
- except Exception as e:
57
- lama_cleaner_enable = False
 
58
 
59
  # segment anything
60
  from segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator
@@ -68,6 +70,7 @@ from diffusers import StableDiffusionInpaintPipeline
68
  from huggingface_hub import hf_hub_download
69
 
70
  from utils import computer_info
 
71
  # relate anything
72
  from ram_utils import iou, sort_and_deduplicate, relation_classes, MLP, show_anns, ram_show_mask
73
  from ram_train_eval import RamModel, RamPredictor
@@ -84,9 +87,10 @@ if lama_cleaner_enable:
84
  import ast
85
 
86
  if kosmos_enable:
87
- # os.system("pip install transformers@git+https://github.com/huggingface/transformers.git@main")
88
  # os.system("pip install transformers==4.32.0")
89
- from kosmos_utils import *
 
90
 
91
  config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
92
  ckpt_repo_id = "ShilongLiu/GroundingDINO"
 
41
  sam_enable = True
42
  inpainting_enable = True
43
  ram_enable = True
44
+
45
+ lama_cleaner_enable = False
46
 
47
  kosmos_enable = True
48
 
 
51
  inpainting_enable = False
52
  kosmos_enable = False
53
 
54
+ if lama_cleaner_enable:
55
+ try:
56
+ from lama_cleaner.model_manager import ModelManager
57
+ from lama_cleaner.schema import Config as lama_Config
58
+ except Exception as e:
59
+ lama_cleaner_enable = False
60
 
61
  # segment anything
62
  from segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator
 
70
  from huggingface_hub import hf_hub_download
71
 
72
  from utils import computer_info
73
+
74
  # relate anything
75
  from ram_utils import iou, sort_and_deduplicate, relation_classes, MLP, show_anns, ram_show_mask
76
  from ram_train_eval import RamModel, RamPredictor
 
87
  import ast
88
 
89
  if kosmos_enable:
90
+ os.system("pip install transformers@git+https://github.com/huggingface/transformers.git@main")
91
  # os.system("pip install transformers==4.32.0")
92
+
93
+ from kosmos_utils import *
94
 
95
  config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
96
  ckpt_repo_id = "ShilongLiu/GroundingDINO"
kosmos_utils.py CHANGED
@@ -6,10 +6,10 @@ import torch
6
  import torchvision.transforms as torchvision_T
7
  from PIL import Image
8
 
9
- # from transformers import AutoProcessor, AutoModelForVision2Seq
10
- import subprocess, io, os, sys, time
11
- sys.path.insert(0, './transformers_4_35_0')
12
- from transformers_4_35_0 import AutoProcessor, AutoModelForVision2Seq
13
 
14
  import cv2
15
  import ast
 
6
  import torchvision.transforms as torchvision_T
7
  from PIL import Image
8
 
9
+ from transformers import AutoProcessor, AutoModelForVision2Seq
10
+ # import subprocess, io, os, sys, time
11
+ # sys.path.insert(0, './transformers_4_35_0')
12
+ # from transformers_4_35_0 import AutoProcessor, AutoModelForVision2Seq
13
 
14
  import cv2
15
  import ast