class_docstr: Triton HttpClient
  
  Args:
      url(`string`): IP address and port for the triton server, such as '<host>:<port>' and  '127.0.0.1:8001'.
      model_name(`string`): Model name in triton, defaults to 'pipeline'.
  
  Examples:
      >>> from towhee import triton_client
      >>> client = triton_client('<your-ip>:<your-port>')
      >>> res = client('your-data')
      >>> client.close()
  
      You can also run as following:
      >>> with triton_client('<your-ip>:<your-port>') as client:
      ...     res = client('your-data')
  
      Batch interface.
      >>> data = [data1, data2, data3, data4, data5]
      >>> res = client(data, batch_size=4, safe=True)
      >>> client.close()
  
      You can also run as following:
      >>> with triton_client('<your-ip>:<your-port>') as client:
      ...     res = client(data, batch_size=4)
class_docstr_tok: ["Triton","HttpClient","Args",":","url","(","`","string","`",")",":","IP","address","and","port","for","the","triton","server",",","such","as","'","<","host",">",":","<","port",">","'","and","'127.0.0.1:8001","'",".","model_name","(","`","string","`",")",":","Model","name","in","triton",",","defaults","to","'pipeline","'",".","Examples",":",">",">",">","from","towhee","import","triton_client",">",">",">","client","=","triton_client","(","'","<","your-ip",">",":","<","your-port",">","'",")",">",">",">","res","=","client","(","'your-data","'",")",">",">",">","client.close","(",")","You","can","also","run","as","following",":",">",">",">","with","triton_client","(","'","<","your-ip",">",":","<","your-port",">","'",")","as","client",":","...","res","=","client","(","'your-data","'",")","Batch","interface",".",">",">",">","data","=","[","data1",",","data2",",","data3",",","data4",",","data5","]",">",">",">","res","=","client","(","data",",","batch_size=4",",","safe=True",")",">",">",">","client.close","(",")","You","can","also","run","as","following",":",">",">",">","with","triton_client","(","'","<","your-ip",">",":","<","your-port",">","'",")","as","client",":","...","res","=","client","(","data",",","batch_size=4",")"]
code: def batch(self, pipe_inputs: List, batch_size=4, safe=False):
      batch_inputs = [
          self._solve_inputs(pipe_inputs[i : i + batch_size])
          for i in range(0, len(pipe_inputs), batch_size)
      ]
      caller = self._safe_call if safe else self._call
      outputs = asyncio.run(self._multi_call(caller, batch_inputs))
      ret = []
      for batch in outputs:
          for single in batch:
              ret.append(single)
      return ret
  
file_path: towhee/towhee/serve/triton/pipeline_client.py
imports: import asyncio
  from typing import List
  import numpy
  from towhee.serve.triton.constant import PIPELINE_NAME
  from towhee.utils.serializer import to_json, from_json
  from towhee.utils.log import engine_log
  from towhee.utils.triton_httpclient import aio_httpclient
label_desc: Use image node_id 3 for calling the Client obj's underlying member method code with example usage: obj.batch(pipe_inputs, batch_size, safe) and returns: ret