code: def _get_predict_instance(cfg):
      flag = input("是否使用范例[y/n]，退出请输入: exit .... ")
      flag = flag.strip().lower()
      if flag == "y" or flag == "yes":
          sentence = "歌曲《人生长路》出自刘德华国语专辑《男人的爱》，由李泉作词作曲，2001年出行发版"
          head = "男人的爱"
          tail = "人生长路"
          head_type = "所属专辑"
          tail_type = "歌曲"
      elif flag == "n" or flag == "no":
          sentence = input("请输入句子：")
          head = input("请输入句中需要预测关系的头实体：")
          head_type = input("请输入头实体类型：")
          tail = input("请输入句中需要预测关系的尾实体：")
          tail_type = input("请输入尾实体类型：")
      elif flag == "exit":
          sys.exit(0)
      else:
          print("please input yes or no, or exit!")
          _get_predict_instance()
  
      instance = dict()
      instance["sentence"] = sentence.strip()
      instance["head"] = head.strip()
      instance["tail"] = tail.strip()
      if head_type.strip() == "" or tail_type.strip() == "":
          cfg.replace_entity_with_type = False
          instance["head_type"] = "None"
          instance["tail_type"] = "None"
      else:
          instance["head_type"] = head_type.strip()
          instance["tail_type"] = tail_type.strip()
  
      return instance
  
file_path: DeepKE/example/re/standard/predict.py
imports: import os
  import sys
  import torch
  import logging
  import hydra
  from hydra import utils
  from deepke.relation_extraction.standard.tools import Serializer
  from deepke.relation_extraction.standard.tools import _serialize_sentence, _convert_tokens_into_index, _add_pos_seq, _handle_relation_data, _lm_serialize
  import matplotlib.pyplot
  from deepke.relation_extraction.standard.utils import load_pkl, load_csv
  import deepke.relation_extraction.standard.models
label_desc: Use image node_id 2 for calling a global function with example usage: _get_predict_instance(cfg) and returns: instance