Spaces:
Running
on
Zero
Running
on
Zero
Update sketch_126.py
Browse files- sketch_126.py +2 -0
sketch_126.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import AutoImageProcessor, SiglipForImageClassification
|
3 |
from transformers.image_utils import load_image
|
4 |
from PIL import Image
|
@@ -9,6 +10,7 @@ model_name = "prithivMLmods/Sketch-126-DomainNet"
|
|
9 |
model = SiglipForImageClassification.from_pretrained(model_name)
|
10 |
processor = AutoImageProcessor.from_pretrained(model_name)
|
11 |
|
|
|
12 |
def sketch_classification(image):
|
13 |
"""Predicts the sketch category for an input image."""
|
14 |
# Convert the input numpy array to a PIL Image and ensure it has 3 channels (RGB)
|
|
|
1 |
import gradio as gr
|
2 |
+
import spaces
|
3 |
from transformers import AutoImageProcessor, SiglipForImageClassification
|
4 |
from transformers.image_utils import load_image
|
5 |
from PIL import Image
|
|
|
10 |
model = SiglipForImageClassification.from_pretrained(model_name)
|
11 |
processor = AutoImageProcessor.from_pretrained(model_name)
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def sketch_classification(image):
|
15 |
"""Predicts the sketch category for an input image."""
|
16 |
# Convert the input numpy array to a PIL Image and ensure it has 3 channels (RGB)
|