Spaces:
Runtime error
Runtime error
Update segment.py
Browse files- segment.py +2 -0
segment.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
|
| 2 |
from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
|
| 3 |
from PIL import Image
|
|
|
|
| 4 |
import torch
|
| 5 |
from collections import defaultdict
|
| 6 |
import matplotlib.pyplot as plt
|
|
@@ -12,6 +13,7 @@ import argparse
|
|
| 12 |
import matplotlib
|
| 13 |
import gradio as gr
|
| 14 |
|
|
|
|
| 15 |
def load_image(image_path, left=0, right=0, top=0, bottom=0, size = 512):
|
| 16 |
if type(image_path) is str:
|
| 17 |
image = np.array(Image.open(image_path))[:, :, :3]
|
|
|
|
| 1 |
|
| 2 |
from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
|
| 3 |
from PIL import Image
|
| 4 |
+
import spaces
|
| 5 |
import torch
|
| 6 |
from collections import defaultdict
|
| 7 |
import matplotlib.pyplot as plt
|
|
|
|
| 13 |
import matplotlib
|
| 14 |
import gradio as gr
|
| 15 |
|
| 16 |
+
@spaces.GPU
|
| 17 |
def load_image(image_path, left=0, right=0, top=0, bottom=0, size = 512):
|
| 18 |
if type(image_path) is str:
|
| 19 |
image = np.array(Image.open(image_path))[:, :, :3]
|