xtlyxt commited on
Commit
cfa8b24
·
verified ·
1 Parent(s): c4d5f50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -9,12 +9,20 @@ import torch
9
 
10
 
11
  from PIL import Image
12
- from transformers import ViTForImageClassification, ViTImageProcessor
 
 
 
 
 
 
 
 
13
 
14
  # Load the model
15
  model_name = "trpakov/vit-face-expression"
16
- model = ViTForImageClassification.from_pretrained(model_name)
17
- image_processor = ViTImageProcessor.from_pretrained(model_name)
18
 
19
  # Streamlit app
20
  st.title("Emotion Recognition with vit-face-expression")
@@ -43,6 +51,6 @@ if uploaded_image:
43
 
44
 
45
  # Display scores for each category
46
- st.write("Emotion Scores:")
47
- for label, score in zip(emotion_labels, outputs.logits[0]):
48
- st.write(f"{label}: {score:.4f}")
 
9
 
10
 
11
  from PIL import Image
12
+ #from transformers import ViTForImageClassification, ViTImageProcessor
13
+
14
+
15
+ from transformers import AutoImageProcessor, AutoModelForImageClassification
16
+
17
+ # Load the model
18
+ model_name = "trpakov/vit-face-expression"
19
+ processor = AutoImageProcessor.from_pretrained(model_name)
20
+ model = AutoModelForImageClassification.from_pretrained(model_name)
21
 
22
  # Load the model
23
  model_name = "trpakov/vit-face-expression"
24
+ #model = ViTForImageClassification.from_pretrained(model_name)
25
+ #image_processor = ViTImageProcessor.from_pretrained(model_name)
26
 
27
  # Streamlit app
28
  st.title("Emotion Recognition with vit-face-expression")
 
51
 
52
 
53
  # Display scores for each category
54
+ #st.write("Emotion Scores:")
55
+ #for label, score in zip(emotion_labels, outputs.logits[0]):
56
+ # st.write(f"{label}: {score:.4f}")