Spaces:
Running
on
Zero
Running
on
Zero
Update age_classification.py
Browse files- age_classification.py +2 -0
age_classification.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from transformers import AutoImageProcessor
|
| 3 |
from transformers import SiglipForImageClassification
|
| 4 |
from transformers.image_utils import load_image
|
|
@@ -10,6 +11,7 @@ model_name = "prithivMLmods/Age-Classification-SigLIP2"
|
|
| 10 |
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 11 |
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 12 |
|
|
|
|
| 13 |
def age_classification(image):
|
| 14 |
"""Predicts the age group of a person from an image."""
|
| 15 |
image = Image.fromarray(image).convert("RGB")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
from transformers import AutoImageProcessor
|
| 4 |
from transformers import SiglipForImageClassification
|
| 5 |
from transformers.image_utils import load_image
|
|
|
|
| 11 |
model = SiglipForImageClassification.from_pretrained(model_name)
|
| 12 |
processor = AutoImageProcessor.from_pretrained(model_name)
|
| 13 |
|
| 14 |
+
@spaces.GPU
|
| 15 |
def age_classification(image):
|
| 16 |
"""Predicts the age group of a person from an image."""
|
| 17 |
image = Image.fromarray(image).convert("RGB")
|