chansung commited on
Commit
d9a39c6
·
1 Parent(s): d69a021

add custom handler

Browse files
__pycache__/handler.cpython-38.pyc CHANGED
Binary files a/__pycache__/handler.cpython-38.pyc and b/__pycache__/handler.cpython-38.pyc differ
 
handler.py CHANGED
@@ -22,9 +22,11 @@ class EndpointHandler():
22
  def __call__(self, data: Dict[str, Any]) -> str:
23
  # get inputs
24
  latent = data.pop("inputs", data)
 
 
25
  latent = base64.b64decode(latent)
26
  latent = np.frombuffer(latent, dtype="float32")
27
- latent = np.reshape(latent, (1, 64, 64, 4))
28
 
29
  decoded = self.decoder.predict_on_batch(latent)
30
  decoded = ((decoded + 1) / 2) * 255
 
22
  def __call__(self, data: Dict[str, Any]) -> str:
23
  # get inputs
24
  latent = data.pop("inputs", data)
25
+ batch_size = data.pop("batch_size", 1)
26
+
27
  latent = base64.b64decode(latent)
28
  latent = np.frombuffer(latent, dtype="float32")
29
+ latent = np.reshape(latent, (batch_size, 64, 64, 4))
30
 
31
  decoded = self.decoder.predict_on_batch(latent)
32
  decoded = ((decoded + 1) / 2) * 255
text-encoder ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit e06cb5f39e98f1035306142bb72769ce1ba93d73