sumonta056
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import
|
3 |
|
4 |
-
model_path = "./"
|
5 |
-
model = BertForSequenceClassification.from_pretrained(model_path)
|
6 |
-
tokenizer = BertTokenizerFast.from_pretrained(model_path)
|
7 |
-
nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
8 |
|
9 |
-
# Streamlit app
|
10 |
-
st.title("Simple Emotion Analyzer")
|
|
|
|
|
|
|
11 |
|
12 |
# Input text
|
13 |
text = st.text_area("Enter text to analyze:")
|
14 |
|
15 |
if text:
|
16 |
-
result =
|
17 |
st.json(result)
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# model_path = "./"
|
5 |
+
# model = BertForSequenceClassification.from_pretrained(model_path)
|
6 |
+
# tokenizer = BertTokenizerFast.from_pretrained(model_path)
|
7 |
+
# nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
8 |
|
9 |
+
# # Streamlit app
|
10 |
+
# st.title("Simple Emotion Analyzer")
|
11 |
+
|
12 |
+
|
13 |
+
pipe = pipeline('sentiment-analysis')
|
14 |
|
15 |
# Input text
|
16 |
text = st.text_area("Enter text to analyze:")
|
17 |
|
18 |
if text:
|
19 |
+
result = pipe(text)
|
20 |
st.json(result)
|