amruthakp7 commited on
Commit
3e53610
1 Parent(s): 7d98a96

from_csv added

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -4,6 +4,21 @@ import skimage
4
 
5
  learn = load_learner('export.pkl')
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  labels = learn.dls.vocab
8
  def predict(img):
9
  img = PILImage.create(img)
 
4
 
5
  learn = load_learner('export.pkl')
6
 
7
+ def from_csv(x):
8
+ try:
9
+ pattern = '\/([A-Za-z\d]+.jpg)'
10
+
11
+ match = re.findall(pattern,str(x))
12
+ # print(match)
13
+ x = df.loc[df['image'] == match[0]]
14
+ # print(x)
15
+ y = x['emotion'].item() # #y=x['label'].values[0]
16
+ return str(y)
17
+ except:
18
+ print('check these files')
19
+ print(x)
20
+ return 0
21
+
22
  labels = learn.dls.vocab
23
  def predict(img):
24
  img = PILImage.create(img)