Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from PIL import Image
|
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
def predict_image(image):
|
| 9 |
-
pipe = pipeline("image-classification", model="
|
| 10 |
|
| 11 |
if isinstance(image, np.ndarray):
|
| 12 |
image = Image.fromarray(image.astype('uint8'))
|
|
@@ -18,10 +18,7 @@ def predict_image(image):
|
|
| 18 |
label = result[0]['label']
|
| 19 |
confidence = result[0]['score']
|
| 20 |
|
| 21 |
-
|
| 22 |
-
print(f"Prediction: {prediction}, Confidence: {confidence}")
|
| 23 |
-
|
| 24 |
-
return prediction, confidence
|
| 25 |
|
| 26 |
example_images = [
|
| 27 |
os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|
|
|
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
def predict_image(image):
|
| 9 |
+
pipe = pipeline("image-classification", model="rizvandwiki/gender-classification")
|
| 10 |
|
| 11 |
if isinstance(image, np.ndarray):
|
| 12 |
image = Image.fromarray(image.astype('uint8'))
|
|
|
|
| 18 |
label = result[0]['label']
|
| 19 |
confidence = result[0]['score']
|
| 20 |
|
| 21 |
+
return label, confidence
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
example_images = [
|
| 24 |
os.path.join("examples", img_name) for img_name in sorted(os.listdir("examples"))
|