import tensorflow as tf

class python_model():
    def __init__(self,model_path):
        # 读取模型
        output_graph_def = tf.GraphDef()
        # 打开.pb模型
        with open(model_path, "rb") as f:
            output_graph_def.ParseFromString(f.read())
            tensors = tf.import_graph_def(output_graph_def, name="")

        self.__sess = tf.Session()
        self.__sess.run(tf.global_variables_initializer())
        graph = tf.get_default_graph()
        self.__input = graph.get_tensor_by_name("input:0")
        self.__output = graph.get_tensor_by_name("output/Softmax:0")

    def inference(self,input):
        output = self.__sess.run(self.__output, feed_dict={self.__input: input})
        return output

602831ccc352f3549f71454b16b1aa0b3170f704
<mask token>


class python_model:
    <mask token>
    <mask token>

<mask token>


class python_model:
    <mask token>

    def inference(self, input):
        output = self.__sess.run(self.__output, feed_dict={self.__input: input}
            )
        return output

<mask token>


class python_model:

    def __init__(self, model_path):
        output_graph_def = tf.GraphDef()
        with open(model_path, 'rb') as f:
            output_graph_def.ParseFromString(f.read())
            tensors = tf.import_graph_def(output_graph_def, name='')
        self.__sess = tf.Session()
        self.__sess.run(tf.global_variables_initializer())
        graph = tf.get_default_graph()
        self.__input = graph.get_tensor_by_name('input:0')
        self.__output = graph.get_tensor_by_name('output/Softmax:0')

    def inference(self, input):
        output = self.__sess.run(self.__output, feed_dict={self.__input: input}
            )
        return output

import tensorflow as tf


class python_model:

    def __init__(self, model_path):
        output_graph_def = tf.GraphDef()
        with open(model_path, 'rb') as f:
            output_graph_def.ParseFromString(f.read())
            tensors = tf.import_graph_def(output_graph_def, name='')
        self.__sess = tf.Session()
        self.__sess.run(tf.global_variables_initializer())
        graph = tf.get_default_graph()
        self.__input = graph.get_tensor_by_name('input:0')
        self.__output = graph.get_tensor_by_name('output/Softmax:0')

    def inference(self, input):
        output = self.__sess.run(self.__output, feed_dict={self.__input: input}
            )
        return output

import tensorflow as tf

class python_model():
    def __init__(self,model_path):
        # 读取模型
        output_graph_def = tf.GraphDef()
        # 打开.pb模型
        with open(model_path, "rb") as f:
            output_graph_def.ParseFromString(f.read())
            tensors = tf.import_graph_def(output_graph_def, name="")

        self.__sess = tf.Session()
        self.__sess.run(tf.global_variables_initializer())
        graph = tf.get_default_graph()
        self.__input = graph.get_tensor_by_name("input:0")
        self.__output = graph.get_tensor_by_name("output/Softmax:0")

    def inference(self,input):
        output = self.__sess.run(self.__output, feed_dict={self.__input: input})
        return output
