code: def interactive(opt):
      if isinstance(opt, ParlaiParser):
          logging.error("interactive should be passed opt not Parser")
          opt = opt.parse_args()
  
      # Create model and assign it to the specified task
      agent = create_agent(opt, requireModelExists=True)
      agent.opt.log()
      human_agent = LocalHumanAgent(opt)
      # set up world logger
      world_logger = WorldLogger(opt) if opt.get("outfile") else None
      world = create_task(opt, [human_agent, agent])
  
      # Show some example dialogs:
      while not world.epoch_done():
          world.parley()
          if world.epoch_done() or world.get_total_parleys() <= 0:
              # chat was reset with [DONE], [EXIT] or EOF
              if world_logger is not None:
                  world_logger.reset()
              continue
  
          if world_logger is not None:
              world_logger.log(world)
          if opt.get("display_examples"):
              print("---")
              print(world.display())
  
      if world_logger is not None:
          # dump world acts to file
          world_logger.write(
              opt["outfile"], world, file_format=opt["save_format"]
          )
  
file_path: ParlAI/parlai/scripts/interactive.py
imports: from parlai.core.params import ParlaiParser
  from parlai.core.agents import create_agent
  from parlai.core.worlds import create_task
  from parlai.core.script import ParlaiScript, register_script
  from parlai.utils.world_logging import WorldLogger
  from parlai.agents.local_human.local_human import LocalHumanAgent
  import parlai.utils.logging
  import random
label_desc: Use image node_id 2 for calling a global function with example usage: interactive(opt) without return types