class_docstr: Interactive Handler.
class_docstr_tok: ["Interactive","Handler","."]
docstr: Generate a model response.
  
  :param data:
      data to send to model
  
  :return:
      model act dictionary
docstr_tok: ["Generate","a","model","response",".",":","param","data",":","data","to","send","to","model",":","return",":","model","act","dictionary"]
code: def interactive_running(self, data):
      """
      Generate a model response.
  
      :param data:
          data to send to model
  
      :return:
          model act dictionary
      """
      reply = {}
      if type(data["personality"][0]) is bytes:
          reply["text"] = data["personality"][0].decode("utf-8")
      else:
          reply["text"] = data["personality"][0]
      if type(data["text"][0]) is bytes:
          text = data["text"][0].decode("utf-8")
      else:
          text = data["text"][0]
      if text:
          reply["text"] = "\n".join(
              SHARED["dialog_history"] + [text, reply["text"]]
          )
          SHARED["dialog_history"].append(text)
      if SHARED["image_feats"] is None:
          if type(data["image"][0]) is bytes:
              img_data = data["image"][0].decode("utf-8")
              _, encoded = img_data.split(",", 1)
              encoded = encoded[2:-1]
          else:
              img_data = data["image"][0]
              _, encoded = img_data.split(",", 1)
          image = Image.open(io.BytesIO(b64decode(encoded))).convert(
              "RGB"
          )
          SHARED["image_feats"] = SHARED["image_loader"].extract(image)
  
      reply["image"] = SHARED["image_feats"]
      SHARED["agent"].observe(reply)
      model_res = SHARED["agent"].act()
      return model_res
  
imports: from typing import Dict, Any
  from http.server import BaseHTTPRequestHandler, HTTPServer
  from parlai.scripts.interactive import setup_args
  from parlai.core.agents import create_agent
  from parlai.core.worlds import create_task
  from parlai.core.image_featurizers import ImageLoader
  import json
  import cgi
  import PIL.Image
  from base64 import b64decode
  import io
  import os
label_desc: Use image node_id 1 for calling the MyHandler obj's underlying member method code with example usage: obj.interactive_running(data) and returns: model_res