MarieAngeA13
commited on
Commit
·
3d91c59
1
Parent(s):
1458c90
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
4 |
-
from googletrans import Translator
|
5 |
-
|
6 |
# Load the sentiment analysis model from our BERT model
|
7 |
classifier = pipeline("text-classification", model = "MarieAngeA13/Sentiment-Analysis-BERT")
|
8 |
|
@@ -11,19 +9,8 @@ st.title('Sentiment Analysis with BERT')
|
|
11 |
st.write('Enter some text and we will predict its sentiment!')
|
12 |
|
13 |
# Add a text input box for the user to enter text
|
14 |
-
translator = Translator()
|
15 |
text_input = st.text_input('Enter text here')
|
16 |
|
17 |
-
detected_language = translator.detect(text_input).lang
|
18 |
-
|
19 |
-
if detected_language == 'fr':
|
20 |
-
translation = translator.translate(text_input, src='fr', dest='en')
|
21 |
-
translated_text = translation.text
|
22 |
-
else:
|
23 |
-
translated_text = text_input
|
24 |
-
print(translated_text)
|
25 |
-
|
26 |
-
|
27 |
|
28 |
# When the user submits text, run the sentiment analysis model on it
|
29 |
if st.button('Submit'):
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
|
|
|
|
4 |
# Load the sentiment analysis model from our BERT model
|
5 |
classifier = pipeline("text-classification", model = "MarieAngeA13/Sentiment-Analysis-BERT")
|
6 |
|
|
|
9 |
st.write('Enter some text and we will predict its sentiment!')
|
10 |
|
11 |
# Add a text input box for the user to enter text
|
|
|
12 |
text_input = st.text_input('Enter text here')
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# When the user submits text, run the sentiment analysis model on it
|
16 |
if st.button('Submit'):
|