Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,7 @@ import mediapipe as mp
|
|
| 42 |
from transformers import pipeline
|
| 43 |
from skimage.measure import label, regionprops
|
| 44 |
import matplotlib.pyplot as plt
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
def _normalized_to_pixel_coordinates(
|
|
@@ -101,7 +102,7 @@ def create_bounding_box_mask(image):
|
|
| 101 |
return bounding_mask
|
| 102 |
|
| 103 |
|
| 104 |
-
|
| 105 |
def segment_2(image_np, coordinates):
|
| 106 |
OVERLAY_COLOR = (255, 105, 180) # Rose
|
| 107 |
|
|
@@ -164,7 +165,7 @@ def segment_2(image_np, coordinates):
|
|
| 164 |
|
| 165 |
return output_image,bbox_mask_image
|
| 166 |
|
| 167 |
-
|
| 168 |
def generate_2(image_file_path, bbox_image, prompt):
|
| 169 |
|
| 170 |
# Read image
|
|
|
|
| 42 |
from transformers import pipeline
|
| 43 |
from skimage.measure import label, regionprops
|
| 44 |
import matplotlib.pyplot as plt
|
| 45 |
+
import spaces
|
| 46 |
|
| 47 |
|
| 48 |
def _normalized_to_pixel_coordinates(
|
|
|
|
| 102 |
return bounding_mask
|
| 103 |
|
| 104 |
|
| 105 |
+
@spaces.GPU
|
| 106 |
def segment_2(image_np, coordinates):
|
| 107 |
OVERLAY_COLOR = (255, 105, 180) # Rose
|
| 108 |
|
|
|
|
| 165 |
|
| 166 |
return output_image,bbox_mask_image
|
| 167 |
|
| 168 |
+
@spaces.GPU
|
| 169 |
def generate_2(image_file_path, bbox_image, prompt):
|
| 170 |
|
| 171 |
# Read image
|