docstr: Get the sentiment prediction results results with the texts as input
  Args:
       texts(list): the input texts to be predicted which the first element is text_1(list)
                    and the second element is text_2(list), such as [['这道题很难'], ['这道题不简单']]
                    if texts not data.
       data(dict): key must be 'text_1' and 'text_2', value is the texts(list) to be predicted
       use_gpu(bool): whether use gpu to predict or not
       batch_size(int): the program deals once with one batch
  Returns:
       results(list): the word segmentation results
docstr_tok: ["Get","the","sentiment","prediction","results","results","with","the","texts","as","input","Args",":","texts","(","list",")",":","the","input","texts","to","be","predicted","which","the","first","element","is","text_1","(","list",")","and","the","second","element","is","text_2","(","list",")",",","such","as","[","[","'\u8fd9\u9053\u9898\u5f88\u96be","'","]",",","[","'\u8fd9\u9053\u9898\u4e0d\u7b80\u5355","'","]","]","if","texts","not","data",".","data","(","dict",")",":","key","must","be","'text_1","'","and","'text_2","'",",","value","is","the","texts","(","list",")","to","be","predicted","use_gpu","(","bool",")",":","whether","use","gpu","to","predict","or","not","batch_size","(","int",")",":","the","program","deals","once","with","one","batch","Returns",":","results","(","list",")",":","the","word","segmentation","results"]
code: def similarity(self, texts=[], data={}, use_gpu=False, batch_size=1):
      """
      Get the sentiment prediction results results with the texts as input
      Args:
           texts(list): the input texts to be predicted which the first element is text_1(list)
                        and the second element is text_2(list), such as [['这道题很难'], ['这道题不简单']]
                        if texts not data.
           data(dict): key must be 'text_1' and 'text_2', value is the texts(list) to be predicted
           use_gpu(bool): whether use gpu to predict or not
           batch_size(int): the program deals once with one batch
      Returns:
           results(list): the word segmentation results
      """
      if use_gpu:
          try:
              _places = os.environ["CUDA_VISIBLE_DEVICES"]
              int(_places[0])
          except:
              raise RuntimeError(
                  "Environment Variable CUDA_VISIBLE_DEVICES is not set correctly. If you wanna use gpu, please set CUDA_VISIBLE_DEVICES as cuda_device_id."
              )
  
      data = self.check_data(texts, data)
  
      start_idx = 0
      iteration = int(math.ceil(len(data["text_1"]) / batch_size))
      results = []
      for i in range(iteration):
          batch_data = {"text_1": [], "text_2": []}
          if i < (iteration - 1):
              batch_data["text_1"] = data["text_1"][
                  start_idx : (start_idx + batch_size)
              ]
              batch_data["text_2"] = data["text_2"][
                  start_idx : (start_idx + batch_size)
              ]
          else:
              batch_data["text_1"] = data["text_1"][
                  start_idx : (start_idx + batch_size)
              ]
              batch_data["text_2"] = data["text_2"][
                  start_idx : (start_idx + batch_size)
              ]
          start_idx = start_idx + batch_size
          processed_results = preprocess(
              self.word_seg_module,
              self.vocab,
              batch_data,
              use_gpu,
              batch_size,
          )
  
          data_1, lod_1, shape_1 = self._texts_process(
              processed_results["text_1"]
          )
          data_2, lod_2, shape_2 = self._texts_process(
              processed_results["text_2"]
          )
  
          predictor = (
              self.gpu_predictor if use_gpu else self.cpu_predictor
          )
  
          input_names = predictor.get_input_names()
          input_handle = predictor.get_input_handle(input_names[0])
          input_handle.copy_from_cpu(data_1)
          input_handle.set_lod(lod_1)
          input_handle.reshape(shape_1)
  
          input_handle = predictor.get_input_handle(input_names[1])
          input_handle.copy_from_cpu(data_2)
          input_handle.set_lod(lod_2)
          input_handle.reshape(shape_2)
  
          predictor.run()
          output_names = predictor.get_output_names()
          output_handle = predictor.get_output_handle(output_names[1])
          batch_out = output_handle.copy_to_cpu()
  
          batch_result = postprocess(batch_out, processed_results)
          results += batch_result
      return results
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import ast
  import json
  import math
  import os
  import numpy
  import six
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from simnet_bow.processor import load_vocab
  from simnet_bow.processor import postprocess
  from simnet_bow.processor import preprocess
  import paddlehub
  from paddlehub.common.paddle_helper import add_vars_prefix
  from paddlehub.common.paddle_helper import get_variable_info
  from paddlehub.common.utils import sys_stdin_encoding
  from paddlehub.io.parser import txt_parser
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
label_desc: Use image node_id 7 for calling the SimnetBow obj's underlying member method code with example usage: obj.similarity(texts, data, use_gpu, batch_size) and returns: results