service_provider.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:skp_edu_docker 作者: TensorMSA 项目源码 文件源码
def _internal_service_call(self, share_data) :
        try:
            # internal : IMAGE
            print("?????????? ??? ?? ?? ?? ?? ?????????? ")

            temp = {}
            request_type = share_data.get_request_type()
            decode_text = base64.decodebytes(str.encode(share_data.get_request_data()))
            temp['test'] = [InMemoryUploadedFile(io.BytesIO(decode_text), None, 'test.jpg', 'image/jpeg', len(decode_text), None)]
            ml = MultiValueDict(temp)
            # fp = open("/hoya_src_root/nn00004/1/test1.jpg", 'wb')
            # fp.write(decode_text)
            # fp.close()
            # CNN Prediction
            if(request_type == "image"):
                return_val = PredictNetCnn().run('nn00004', None, ml )
                name_tag = {"KYJ" : "???", "KSW" : "???", "LTY" : "???", "LSH" : "???", "PJH" : "???", "KSS" : "???", "PSC" : "???"}
                print("?????????? ??? ?? ?? ?? ?? : " + return_val['test.jpg']['key'][0])
                share_data.set_output_data(name_tag[return_val['test.jpg']['key'][0]] + "?? ??? ????")
            else :
                share_data.set_output_data("??? ?? ??? ????")

            return share_data
        except Exception as e:
            raise Exception(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号