Update 1/model.py
This commit is contained in:
parent
9881ed59ce
commit
2226bf03c0
13
1/model.py
13
1/model.py
@ -7,18 +7,21 @@ import string
|
|||||||
class TritonPythonModel:
|
class TritonPythonModel:
|
||||||
def initialize(self, args):
|
def initialize(self, args):
|
||||||
self.logger = pb_utils.Logger
|
self.logger = pb_utils.Logger
|
||||||
self.model_name = args["model_name"]
|
self.logger.log_info(f"'{args["model_name"]}' 모델 초기화 완료")
|
||||||
self.logger.log_info(f"'{self.model_name}' 모델 초기화 완료")
|
|
||||||
|
|
||||||
|
|
||||||
def execute(self, requests):
|
def execute(self, requests):
|
||||||
responses = []
|
responses = []
|
||||||
|
|
||||||
for request in requests:
|
for request in requests:
|
||||||
|
input_tensor = pb_utils.get_input_tensor_by_name(request, "INPUT")
|
||||||
|
|
||||||
|
input_data = input_tensor.as_numpy()[0].decode("utf-8")
|
||||||
|
self.logger.log_info(f"INPUT: {input_data}")
|
||||||
|
|
||||||
random_string = ''.join(
|
random_string = ''.join(
|
||||||
random.choice(string.ascii_letters + string.digits) for _ in range(16)
|
random.choice(string.ascii_letters + string.digits) for _ in range(10)
|
||||||
)
|
)
|
||||||
self.logger.log_info(f"OUTPUT 출력:\n{random_string}")
|
self.logger.log_info(f"OUTPUT: {random_string}")
|
||||||
|
|
||||||
output_tensor = pb_utils.Tensor(
|
output_tensor = pb_utils.Tensor(
|
||||||
"OUTPUT",
|
"OUTPUT",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user