merve HF staff commited on
Commit
13f8a60
·
1 Parent(s): e621b6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -7,4 +7,11 @@ inputs = [gr.Textbox(value = "I love this!")]
7
  outputs = [gr.Label(label = "Sentiment")]
8
  title = "Sentiment Analysis Classifier"
9
  description = "This is a sentiment classifier using longformer model with a logistic regression head. "
 
 
 
 
 
 
 
10
  gr.Interface(infer, inputs = inputs, outputs = outputs, title = title, description = description).launch()
 
7
  outputs = [gr.Label(label = "Sentiment")]
8
  title = "Sentiment Analysis Classifier"
9
  description = "This is a sentiment classifier using longformer model with a logistic regression head. "
10
+ def infer(inputs):
11
+ predictions = pipe.predict_proba([inputs])
12
+ label = {
13
+ "negative":str(predictions[0][0]),
14
+ "positive":str(predictions[0][1]),
15
+ }
16
+ return label
17
  gr.Interface(infer, inputs = inputs, outputs = outputs, title = title, description = description).launch()