itsTomLie commited on
Commit
b8124d1
1 Parent(s): 3b44b2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
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="itsTomLie/genders_microsoft_resnet50")
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
- prediction = 'female' if label == 'LABEL_0' else 'male'
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"))