Update app.py
Browse files
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
|