def init_model_data(self):
        if self.model_core is None:
            cwd = os.getcwd()
            if cwd == '/app':  # 在docker容器中运行
                os.chdir('/app/model/model/scripts/user_provided')

            try:
                self.model_core = ModelCore()
            except:
                self.model_core = None

            os.chdir(cwd)
 def init_global_data(self):
     try:
         self.model_core = ModelCore()  # 初始化功能代码
         return True
     except Exception as e:
         logging.error(str(e))
         return False
class ModelService(object):

    # 声明model_core对象并赋空置。必须存在,不要修改或删除!!!
    def __init__(self):
        self.model_core = None

    # 从文件中加载模型数据,例如预训练好的模型参数等。必须存在,不要修改或删除!!!
    def init_model_data(self):
        if self.model_core is None:
            cwd = os.getcwd()
            if cwd == '/app':  # 在docker容器中运行
                os.chdir('/app/model/model/scripts/user_provided')

            try:
                self.model_core = ModelCore()
            except:
                self.model_core = None

            os.chdir(cwd)

    # 模型接口函数
    def classify(self, img_base64):
        return self.model_core.classify(img_base64)
Exemple #4
0
from core.model_core import ModelCore
from core.util import image_tools


model_core = ModelCore()


def test():
    img_base64 = model_core.gen_test_img_base64()
    results = model_core.photo2painter_base64(img_base64)
    for img_url in results:
        img = image_tools.url_to_img(img_url)
        img.show()


test()
Exemple #5
0
import os
from core.model_core import ModelCore

model_core = ModelCore()

gif_base64 = model_core.gen_test_img_base64()
print(gif_base64)
model_core = model_core.split_gif_base64(gif_base64)
Exemple #6
0
import os
from core.model_core import ModelCore

model_core = ModelCore()

img_base64 = model_core.gen_test_img_base64()
print(img_base64)
reList = model_core.cut_image_base64(img_base64, 'xxx')
print(reList)
Exemple #7
0
# -*-coding:utf-8-*-
from core.model_core import ModelCore

model_core = ModelCore()
url = 'https://gitee.com/mirrors/CubeAI.git'
# url = 'https://github.com/cube-ai/cubeai.git'
model_core.find_secret(url, 'xxx')