Skip to content

Commit

Permalink
fix: decode only if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ispirtraian committed Apr 18, 2024
1 parent 8bf9927 commit e8e47d6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/src/serving/serving_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,17 @@ def appmon_callback(self):
try:
with open(task_content_path, 'rb') as file:
input = file.read()
# convert if necessary
if model_type == 'text':
input_str = input.decode('utf-8')
try:
#check if list
input = json.loads(input_str)
except json.JSONDecodeError:
input = input_str
except Exception as exc:
self.P("Content file read error: {}".format(exc))
if input is not None:
# convert if necessary
if model_type == 'text':
input_str = input.decode('utf-8')
try:
#check if list
input = json.loads(input_str)
except json.JSONDecodeError:
input = input_str

result = self._predict(
model_type,
input,
Expand Down

0 comments on commit e8e47d6

Please sign in to comment.