Michael54546 commited on
Commit
8a4e59f
·
1 Parent(s): 22cf408

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +20 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ #import torch
3
+ from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
4
+ from transformers import pipeline
5
+
6
+ #st.title("Enter Phrase: ")
7
+ uInput = st.text_input("Enter Phrase: ")
8
+
9
+
10
+ pipe = pipeline(model="finiteautomata/bertweet-base-sentiment-analysis")
11
+ data = [uInput]
12
+ #pipeline(data)
13
+
14
+ col1, col2 = st.columns(2)
15
+
16
+ predictions = pipe(data)
17
+
18
+ col2.header("Probabilities")
19
+ for p in predictions:
20
+ col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch