RoAr777 commited on
Commit
2d0a9a0
1 Parent(s): 9cb6d51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -4,6 +4,11 @@ from fastai.vision.all import *
4
  import matplotlib.pyplot as plt
5
 
6
  # Load the trained model
 
 
 
 
 
7
  learn = load_learner('emotion_model.pkl')
8
 
9
  # Define function to preprocess image
 
4
  import matplotlib.pyplot as plt
5
 
6
  # Load the trained model
7
+ def label_func(fname):
8
+ categories = ["Happy", "Sad", "Angry"]
9
+ category = fname.parts[-2] # Extract the category name from the path
10
+ return category if category in categories else "unknown"
11
+
12
  learn = load_learner('emotion_model.pkl')
13
 
14
  # Define function to preprocess image