Spaces:
Runtime error
Runtime error
Fix numpy error
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import dlib
|
|
| 3 |
import streamlit as st
|
| 4 |
from PIL import Image
|
| 5 |
from transformers import pipeline
|
|
|
|
| 6 |
|
| 7 |
# Load pre-trained image classification model from transformers library
|
| 8 |
model = pipeline("image-classification", model="0x70DA/down-syndrome-classifier")
|
|
@@ -12,7 +13,7 @@ detector = dlib.get_frontal_face_detector()
|
|
| 12 |
|
| 13 |
# Define the prediction function
|
| 14 |
def predict(image):
|
| 15 |
-
img = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
| 16 |
faces = detector(img)
|
| 17 |
if len(faces) > 0:
|
| 18 |
face = faces[0] # Assuming there's only one face in the image
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
from PIL import Image
|
| 5 |
from transformers import pipeline
|
| 6 |
+
import numpy as np
|
| 7 |
|
| 8 |
# Load pre-trained image classification model from transformers library
|
| 9 |
model = pipeline("image-classification", model="0x70DA/down-syndrome-classifier")
|
|
|
|
| 13 |
|
| 14 |
# Define the prediction function
|
| 15 |
def predict(image):
|
| 16 |
+
img = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR) # Convert PIL Image to NumPy array
|
| 17 |
faces = detector(img)
|
| 18 |
if len(faces) > 0:
|
| 19 |
face = faces[0] # Assuming there's only one face in the image
|