Update app.py with references
Browse files
app.py
CHANGED
@@ -3,17 +3,15 @@ from transformers import pipeline
|
|
3 |
|
4 |
st.title('Sentiment Analysis using Transformers pipeline function')
|
5 |
st.write('This app uses the Hugging Face Transformers [sentiment analyzer](https://huggingface.co/course/chapter1/3?fw=tf) library to classify the sentiment of your input as positive or negative. The web app is built using [Streamlit](https://docs.streamlit.io/en/stable/getting_started.html).')
|
6 |
-
st.write(
|
7 |
-
|
8 |
-
|
9 |
-
st.write('*Note: it will take up to 30 seconds to run the app.*')
|
10 |
|
11 |
form = st.form(key='sentiment-form')
|
12 |
user_input = form.text_area('Enter your text')
|
13 |
submit = form.form_submit_button('Submit')
|
14 |
|
15 |
if submit:
|
16 |
-
classifier = pipeline("sentiment-analysis")
|
17 |
result = classifier(user_input)[0]
|
18 |
label = result['label']
|
19 |
score = result['score']
|
|
|
3 |
|
4 |
st.title('Sentiment Analysis using Transformers pipeline function')
|
5 |
st.write('This app uses the Hugging Face Transformers [sentiment analyzer](https://huggingface.co/course/chapter1/3?fw=tf) library to classify the sentiment of your input as positive or negative. The web app is built using [Streamlit](https://docs.streamlit.io/en/stable/getting_started.html).')
|
6 |
+
st.write('References: \n https://medium.com/@rtkilian/deploy-and-share-your-sentiment-analysis-app-using-streamlit-sharing-2ba3ca6a3ead')
|
7 |
+
st.write(' \t\t\t https://huggingface.co/learn/nlp-course/chapter1/3?fw=pt')
|
|
|
|
|
8 |
|
9 |
form = st.form(key='sentiment-form')
|
10 |
user_input = form.text_area('Enter your text')
|
11 |
submit = form.form_submit_button('Submit')
|
12 |
|
13 |
if submit:
|
14 |
+
classifier = pipeline("sentiment-analysis") #using the pipeline() function
|
15 |
result = classifier(user_input)[0]
|
16 |
label = result['label']
|
17 |
score = result['score']
|