Samantha Hipple commited on
Commit
a2167ac
·
1 Parent(s): 92c22ec

image_data ?

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  # from transformers import pipeline
3
  from deepface import DeepFace
 
4
  from PIL import Image
5
 
6
  # pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
@@ -20,13 +21,15 @@ if file_name is not None:
20
  # to display in in column 1
21
  col1.image(image, use_column_width=True)
22
 
23
- # capture predictions
24
- predictions = DeepFace.analyze(file_name, actions=['emotion'])
 
 
25
  # predictions = pipeline(image)
26
 
27
  # to display in column 2
28
  col2.header("Emotion Probabilities")
29
  # for p in predictions:
30
- for emotion in predictions['emotion']:
31
  # col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
32
- col2.subheader(f"{emotion.keys()}: {emotion.values()}")
 
1
  import streamlit as st
2
  # from transformers import pipeline
3
  from deepface import DeepFace
4
+ import numpy as np
5
  from PIL import Image
6
 
7
  # pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
 
21
  # to display in in column 1
22
  col1.image(image, use_column_width=True)
23
 
24
+ # capture image data for deepface
25
+ image_data = np.array(image)
26
+ # capture predictions from deepface
27
+ predictions = DeepFace.analyze(image_data, actions=['emotion'])['emotion']
28
  # predictions = pipeline(image)
29
 
30
  # to display in column 2
31
  col2.header("Emotion Probabilities")
32
  # for p in predictions:
33
+ for emotion in predictions:
34
  # col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
35
+ col2.subheader(f"{emotion}")