aemonshahbaz commited on
Commit
e05fccc
·
verified ·
1 Parent(s): bd019ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,9 +1,12 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- pip = pipelineline('sentiment_analysis')
5
- text = st.text_area('enter some text!')
 
 
 
6
 
7
  if text:
8
- out = pipe(text)
9
- st.json(out)
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load sentiment analysis model
5
+ analyzer = pipeline('sentiment_analysis')
6
+
7
+ # Streamlit UI
8
+ text = st.text_area('Enter some text for sentiment analysis:')
9
 
10
  if text:
11
+ result = analyzer(text)[0]
12
+ st.write(f"**Label:** {result['label']} \n**Confidence:** {result['score']:.2f}")