Spaces:
Running
Running
Update app.py
Browse files
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
|