code: def get_llava_response(
      file,
      llava_model,
      prompt=None,
      image_model="llava-v1.5-13b",
      temperature=0.2,
      top_p=0.7,
      max_new_tokens=512,
  ):
      if prompt in ["auto", None]:
          prompt = "Describe the image and what does the image say?"
      # prompt = "According to the image, describe the image in full details with a well-structured response."
  
      prefix = ""
      if llava_model.startswith("http://"):
          prefix = "http://"
      if llava_model.startswith("https://"):
          prefix = "https://"
      llava_model = llava_model[len(prefix) :]
  
      llava_model_split = llava_model.split(":")
      assert len(llava_model_split) >= 2
      # FIXME: Allow choose model in UI
      if len(llava_model_split) >= 2:
          pass
          # assume default model is ok
          # llava_ip = llava_model_split[0]
          # llava_port = llava_model_split[1]
      if len(llava_model_split) >= 3:
          image_model = llava_model_split[2]
          llava_model = ":".join(llava_model_split[:2])
      # add back prefix
      llava_model = prefix + llava_model
  
      img_str = png_to_base64(file)
  
      from gradio_client import Client
  
      client = Client(llava_model, serialize=False)
      load_res = client.predict(api_name="/demo_load")
      model_options = [x[1] for x in load_res["choices"]]
      assert len(
          model_options
      ), "LLaVa endpoint has no models: %s" % str(load_res)
  
      # if no default choice or default choice not there, choose first
      if not image_model or image_model not in model_options:
          image_model = model_options[0]
  
      # test_file_local, test_file_server = client.predict(file_to_upload, api_name='/upload_api')
  
      image_process_mode = "Default"
      include_image = False
      res1 = client.predict(
          prompt,
          img_str,
          image_process_mode,
          include_image,
          api_name="/textbox_api_btn",
      )
  
      model_selector, temperature, top_p, max_output_tokens = (
          image_model,
          temperature,
          top_p,
          max_new_tokens,
      )
      res = client.predict(
          model_selector,
          temperature,
          top_p,
          max_output_tokens,
          include_image,
          api_name="/textbox_api_submit",
      )
      res = res[-1][-1]
      return res, prompt
  
label_desc: Use image node_id 2 for calling a global function with example usage: get_llava_response(file, llava_model, prompt, image_model, temperature, top_p, max_new_tokens) and returns: res,  prompt