oscarfu0501 commited on
Commit
4fcdff4
1 Parent(s): cceb885

Upload handler.py

Browse files
Files changed (1) hide show
  1. handler.py +12 -12
handler.py CHANGED
@@ -71,7 +71,7 @@ class EndpointHandler:
71
  retval , buffer = cv2.imencode('.jpg', clothes)
72
  cv2.imwrite("result.jpg", clothes)
73
  # create base 64 object
74
- jpg_as_text = base64.b64encode(buffer)
75
  print("checkpoint 4")
76
  ###########################################################################
77
  return jpg_as_text
@@ -80,17 +80,17 @@ class EndpointHandler:
80
 
81
 
82
  # test run
83
- Model = EndpointHandler()
84
- data = {
85
- "inputs": {
86
- "isurl": True,
87
- # "path": "http://10.10.2.100/cam-lo.jpg",
88
- "path": "https://www.next.us/nxtcms/resource/blob/5791586/ee0fc6a294be647924fa5f5e7e3df8e9/hoodies-data.jpg",
89
- # "key": "iJuYzEzNEFSaQq4e0hfE",
90
- }
91
- }
92
- # test file image
93
- print(Model(data))
94
 
95
  #test url
96
  # print(Model("http://10.10.2.100/cam-lo.jpg", 1))
 
71
  retval , buffer = cv2.imencode('.jpg', clothes)
72
  cv2.imwrite("result.jpg", clothes)
73
  # create base 64 object
74
+ jpg_as_text = base64.b64encode(buffer).decode("utf-8") # Decode bytes to string")
75
  print("checkpoint 4")
76
  ###########################################################################
77
  return jpg_as_text
 
80
 
81
 
82
  # test run
83
+ # Model = EndpointHandler()
84
+ # data = {
85
+ # "inputs": {
86
+ # "isurl": True,
87
+ # # "path": "http://10.10.2.100/cam-lo.jpg",
88
+ # "path": "https://www.next.us/nxtcms/resource/blob/5791586/ee0fc6a294be647924fa5f5e7e3df8e9/hoodies-data.jpg",
89
+ # # "key": "iJuYzEzNEFSaQq4e0hfE",
90
+ # }
91
+ # }
92
+ # # test file image
93
+ # print(Model(data))
94
 
95
  #test url
96
  # print(Model("http://10.10.2.100/cam-lo.jpg", 1))