Dharma20 commited on
Commit
a96facb
·
verified ·
1 Parent(s): 4367f1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
5
  learn = load_learner('nlp_model.pkl')
6
 
7
  labels = learn.dls.vocab
 
8
 
9
  examples = ["I can't believe you lied to me again! This is unacceptable!",
10
  "Got a surprise gift today, feeling overjoyed!"]
@@ -13,7 +14,7 @@ examples = ["I can't believe you lied to me again! This is unacceptable!",
13
 
14
  def classify_text(text):
15
  pred,pred_idx,probs = learn.predict(text)
16
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
17
 
18
  interface = gr.Interface(
19
  fn=classify_text,
 
5
  learn = load_learner('nlp_model.pkl')
6
 
7
  labels = learn.dls.vocab
8
+ emotion_labels = labels[1]
9
 
10
  examples = ["I can't believe you lied to me again! This is unacceptable!",
11
  "Got a surprise gift today, feeling overjoyed!"]
 
14
 
15
  def classify_text(text):
16
  pred,pred_idx,probs = learn.predict(text)
17
+ return {emotion_labels[i]: float(probs[i]) for i in range(len(emotion_labels))}
18
 
19
  interface = gr.Interface(
20
  fn=classify_text,