Spaces:
Runtime error
Runtime error
liuyizhang
commited on
Commit
•
5ee6e09
1
Parent(s):
50258c9
update app.py
Browse files- app.py +3 -5
- utils.py → util_computer.py +0 -0
- tencent_utils.py → util_tencent.py +4 -1
app.py
CHANGED
@@ -73,7 +73,7 @@ from io import BytesIO
|
|
73 |
from diffusers import StableDiffusionInpaintPipeline
|
74 |
from huggingface_hub import hf_hub_download
|
75 |
|
76 |
-
from
|
77 |
|
78 |
# relate anything
|
79 |
from ram_utils import iou, sort_and_deduplicate, relation_classes, MLP, show_anns, ram_show_mask
|
@@ -96,10 +96,7 @@ if kosmos_enable:
|
|
96 |
|
97 |
from kosmos_utils import *
|
98 |
|
99 |
-
from
|
100 |
-
tmt_client = get_tmt_client()
|
101 |
-
def getTextTrans(text, source='zh', target='en'):
|
102 |
-
return getTextTrans_tmt(tmt_client, text, source, target)
|
103 |
|
104 |
config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
105 |
ckpt_repo_id = "ShilongLiu/GroundingDINO"
|
@@ -1035,6 +1032,7 @@ class API_Starter:
|
|
1035 |
from gevent import pywsgi
|
1036 |
logger.info(f'\nargs={args}\n')
|
1037 |
computer_info()
|
|
|
1038 |
server = pywsgi.WSGIServer(('0.0.0.0', args.port), self.app)
|
1039 |
server.serve_forever()
|
1040 |
|
|
|
73 |
from diffusers import StableDiffusionInpaintPipeline
|
74 |
from huggingface_hub import hf_hub_download
|
75 |
|
76 |
+
from util_computer import computer_info
|
77 |
|
78 |
# relate anything
|
79 |
from ram_utils import iou, sort_and_deduplicate, relation_classes, MLP, show_anns, ram_show_mask
|
|
|
96 |
|
97 |
from kosmos_utils import *
|
98 |
|
99 |
+
from util_tencent import getTextTrans
|
|
|
|
|
|
|
100 |
|
101 |
config_file = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
102 |
ckpt_repo_id = "ShilongLiu/GroundingDINO"
|
|
|
1032 |
from gevent import pywsgi
|
1033 |
logger.info(f'\nargs={args}\n')
|
1034 |
computer_info()
|
1035 |
+
print(f"Start a api server: http://0.0.0.0:{args.port}/imgCLeaner")
|
1036 |
server = pywsgi.WSGIServer(('0.0.0.0', args.port), self.app)
|
1037 |
server.serve_forever()
|
1038 |
|
utils.py → util_computer.py
RENAMED
File without changes
|
tencent_utils.py → util_tencent.py
RENAMED
@@ -51,4 +51,7 @@ def getTextTrans_tmt(tmt_client, text, source='zh', target='en'):
|
|
51 |
resp = tmt_client.TextTranslate(req)
|
52 |
return resp.TargetText
|
53 |
except Exception as e:
|
54 |
-
return text
|
|
|
|
|
|
|
|
51 |
resp = tmt_client.TextTranslate(req)
|
52 |
return resp.TargetText
|
53 |
except Exception as e:
|
54 |
+
return text
|
55 |
+
|
56 |
+
def getTextTrans(text, source='zh', target='en'):
|
57 |
+
return getTextTrans_tmt(get_tmt_client(), text, source, target)
|