AkinyemiAra commited on
Commit
8397178
·
verified ·
1 Parent(s): cf297dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -6,6 +6,7 @@ from rembg import remove
6
  import gradio as gr
7
  import spaces
8
  import io
 
9
 
10
  # Load the Nomic embed model
11
  processor = AutoImageProcessor.from_pretrained("nomic-ai/nomic-embed-vision-v1.5")
@@ -21,6 +22,9 @@ def focus_on_subject(image: Image.Image) -> Image.Image:
21
  Returns:
22
  PIL.Image.Image: Cropped image with background removed.
23
  """
 
 
 
24
  image = image.convert("RGB")
25
 
26
  # Remove background
 
6
  import gradio as gr
7
  import spaces
8
  import io
9
+ import numpy as np
10
 
11
  # Load the Nomic embed model
12
  processor = AutoImageProcessor.from_pretrained("nomic-ai/nomic-embed-vision-v1.5")
 
22
  Returns:
23
  PIL.Image.Image: Cropped image with background removed.
24
  """
25
+ if isinstance(image, np.ndarray):
26
+ image = Image.fromarray(image)
27
+
28
  image = image.convert("RGB")
29
 
30
  # Remove background