update ieemoo-ai-isempty.py.
This commit is contained in:
@ -7,36 +7,14 @@ import cv2, base64
|
||||
import argparse
|
||||
import sys, os
|
||||
import torch
|
||||
from gevent.pywsgi import WSGIServer
|
||||
from PIL import Image
|
||||
from torchvision import transforms
|
||||
from models.modeling import VisionTransformer, CONFIGS
|
||||
from vit_pytorch import ViT
|
||||
# import logging.config as log_config
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
#Flask对外服务接口
|
||||
|
||||
|
||||
# from skywalking import agent, config
|
||||
# SW_SERVER = os.environ.get('SW_AGENT_COLLECTOR_BACKEND_SERVICES')
|
||||
# SW_SERVICE_NAME = os.environ.get('SW_AGENT_NAME')
|
||||
# if SW_SERVER and SW_SERVICE_NAME:
|
||||
# config.init() #采集服务的地址,给自己的服务起个名称
|
||||
# #config.init(collector="123.60.56.51:11800", service='ieemoo-ai-search') #采集服务的地址,给自己的服务起个名称
|
||||
# agent.start()
|
||||
|
||||
# def setup_logging(path):
|
||||
# if os.path.exists(path):
|
||||
# with open(path, 'r') as f:
|
||||
# config = json.load(f)
|
||||
# log_config.dictConfig(config)
|
||||
# print = logging.getprint("root")
|
||||
# return print
|
||||
|
||||
# print = setup_logging('utils/logging.json')
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
#app.use_reloader=False
|
||||
|
||||
@ -49,9 +27,8 @@ def parse_args():
|
||||
parser.add_argument('--split', type=str, default='overlap', help="Split method")
|
||||
parser.add_argument('--slide_step', type=int, default=2, help="Slide step for overlap split")
|
||||
parser.add_argument('--smoothing_value', type=float, default=0.0, help="Label smoothing value")
|
||||
#parser.add_argument("--pretrained_model", type=str, default="output/emptyjudge5_checkpoint.bin", help="load pretrained model")
|
||||
#parser.add_argument("--pretrained_model", type=str, default="output/ieemooempty_vit_checkpoint.pth", help="load pretrained model") #使用自定义VIT
|
||||
parser.add_argument("--pretrained_model", type=str, default="../module/ieemoo-ai-isempty/model/new/ieemooempty_vit_checkpoint.pth", help="load pretrained model")
|
||||
#使用自定义VIT
|
||||
parser.add_argument("--pretrained_model", type=str, default="../module/ieemoo-ai-isempty/model/now/ieemooempty_vit_checkpoint.pth", help="load pretrained model")
|
||||
opt, unknown = parser.parse_known_args()
|
||||
return opt
|
||||
|
||||
@ -116,7 +93,7 @@ predictor = Predictor(args)
|
||||
|
||||
@app.route("/isempty", methods=['POST'])
|
||||
def get_isempty():
|
||||
print("begin")
|
||||
#print("begin")
|
||||
|
||||
data = request.get_data()
|
||||
|
||||
@ -140,7 +117,7 @@ def getByte(path):
|
||||
return img_str
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host='0.0.0.0', port=8092)
|
||||
app.run(host='0.0.0.0', port=8888)
|
||||
|
||||
# result ={}
|
||||
# imgdata = base64.b64decode(getByte("img.jpg"))
|
||||
|
Reference in New Issue
Block a user