Made updates to UI
Browse filesReplaced the text output with a proper chart like probability graph.
app.py
CHANGED
@@ -7,15 +7,15 @@ model = load_learner('emot.pkl')
|
|
7 |
labels = ['sadnesss','joy','love','anger','fear','surprise']
|
8 |
|
9 |
def make_prediction(text):
|
10 |
-
preds= model.predict(text)
|
11 |
-
return preds
|
12 |
|
13 |
title = 'Emotional assist'
|
14 |
description = 'A haphazard tool for the critically inept, god forbid you actually need one of these in the future'
|
15 |
examples =['Hello Everyone!','How are you today','fine, thank you!','Oh my God!']
|
16 |
enable_queue=True
|
17 |
|
18 |
-
demo = gr.Interface(fn=make_prediction,inputs='text',outputs=
|
19 |
demo.launch()
|
20 |
|
21 |
|
|
|
7 |
labels = ['sadnesss','joy','love','anger','fear','surprise']
|
8 |
|
9 |
def make_prediction(text):
|
10 |
+
choice,pos,preds= model.predict(text)
|
11 |
+
return {labels[i]:float(preds[i]) for i in range(len(labels))}
|
12 |
|
13 |
title = 'Emotional assist'
|
14 |
description = 'A haphazard tool for the critically inept, god forbid you actually need one of these in the future'
|
15 |
examples =['Hello Everyone!','How are you today','fine, thank you!','Oh my God!']
|
16 |
enable_queue=True
|
17 |
|
18 |
+
demo = gr.Interface(fn=make_prediction,inputs='text',outputs=gr.Label())
|
19 |
demo.launch()
|
20 |
|
21 |
|