Ozziey commited on
Commit
d90c395
·
1 Parent(s): 0beb30e

Create app.py

Browse files

Simply returns labels and emotion scores

Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import numpy as np
4
+ from transformers import pipeline
5
+
6
+
7
+ def analyze(poem):
8
+ classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", return_all_scores=True)
9
+ return classifier(poem)
10
+
11
+ gr.Interface(
12
+ fn=analyze,
13
+ inputs= 'text',
14
+ outputs="text",
15
+ allow_flagging=False,).launch();