Skip to content

Commit

Permalink
fix: image load
Browse files Browse the repository at this point in the history
  • Loading branch information
ispirtraian committed Apr 22, 2024
1 parent 503a5a2 commit 31945c8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/src/serving/serving_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ def appmon_callback(self):
while iterate:
task_content_path = f"{self.cache_root}/tasks/{taskid}_{len(content_list)}.bin"
try:
with open(task_content_path, 'rb') as file:
byte_data = file.read()
if model_type == 'text':
with open(task_content_path, 'rb') as file:
byte_data = file.read()
# convert if necessary
if model_type == 'text':
input_str = byte_data.decode('utf-8')
try:
#check if list
input_str = byte_data.decode('utf-8')
try:
#check if list
content_list.append(json.loads(input_str))
except json.JSONDecodeError:
content_list.append(input_str)
if model_type == 'image':
content_list.append(Image.open(io.BytesIO(byte_data)))

except json.JSONDecodeError:
content_list.append(input_str)
if model_type == 'image':
with Image.open(task_content_path) as img:
content_list.append(img)
except FileNotFoundError:
iterate = False
except IOError as exc:
Expand Down

0 comments on commit 31945c8

Please sign in to comment.