code: def serving_method(self, text, mode="search", **kwargs):
      if mode == "search":
          results = self.greedy_search(text, **kwargs)
      else:
          results = self.nucleus_sample(text, **kwargs)
  
      return results
  
file_path: PaddleHub/modules/text/text_generation/GPT2_CPM_LM/module.py
imports: import os
  import paddle
  import numpy
  import paddle.nn
  from paddlehub.module.module import moduleinfo, serving
  from paddlenlp.transformers import GPT2ForPretraining, GPT2ChineseTokenizer, GPT2Model
label_desc: Use image node_id 5 for calling the GPT2_CPM_LM obj's underlying member method code with example usage: obj.serving_method(text, mode) and returns: results