Jangai commited on
Commit
f97cb5f
·
verified ·
1 Parent(s): 70548b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -19,13 +19,15 @@ def predict(image):
19
  try:
20
  logging.info("Received image of type: %s", type(image))
21
  logging.debug("Image content: %s", image)
22
- # Convert the dictionary to a PIL image
 
23
  if isinstance(image, dict):
24
- image = image['image']
 
25
  logging.debug("Converting to NumPy array...")
26
  image = np.array(image).astype('uint8')
27
  logging.debug("Converting NumPy array to PIL image...")
28
- image = Image.fromarray(image, 'RGB')
29
  logging.debug("Image converted successfully.")
30
 
31
  logging.info("Processing image...")
 
19
  try:
20
  logging.info("Received image of type: %s", type(image))
21
  logging.debug("Image content: %s", image)
22
+
23
+ # Use the 'composite' key to get the final image
24
  if isinstance(image, dict):
25
+ image = image['composite']
26
+
27
  logging.debug("Converting to NumPy array...")
28
  image = np.array(image).astype('uint8')
29
  logging.debug("Converting NumPy array to PIL image...")
30
+ image = Image.fromarray(image, 'RGBA').convert('RGB')
31
  logging.debug("Image converted successfully.")
32
 
33
  logging.info("Processing image...")