Update 1/model.py
This commit is contained in:
parent
9881ed59ce
commit
2226bf03c0
15
1/model.py
15
1/model.py
@ -7,18 +7,21 @@ import string
|
||||
class TritonPythonModel:
|
||||
def initialize(self, args):
|
||||
self.logger = pb_utils.Logger
|
||||
self.model_name = args["model_name"]
|
||||
self.logger.log_info(f"'{self.model_name}' 모델 초기화 완료")
|
||||
|
||||
self.logger.log_info(f"'{args["model_name"]}' 모델 초기화 완료")
|
||||
|
||||
def execute(self, requests):
|
||||
responses = []
|
||||
|
||||
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.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",
|
||||
@ -29,7 +32,7 @@ class TritonPythonModel:
|
||||
output_tensors=[output_tensor]
|
||||
))
|
||||
|
||||
return responses
|
||||
return responses
|
||||
|
||||
def finalize(self):
|
||||
pass
|
||||
Loading…
Reference in New Issue
Block a user