decodingdatascience commited on
Commit
95ef49a
·
1 Parent(s): 6bd2158

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -0
main.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Title of the app
5
+ st.title("DDS Sentiment Analysis with Transformers")
6
+
7
+ # Sentiment analysis pipeline
8
+ sentiment_pipeline = pipeline("sentiment-analysis")
9
+
10
+ # User input text area
11
+ user_input = st.text_area("Enter Text", "Type your text here...")
12
+
13
+ # Analyze button
14
+ if st.button("Analyze"):
15
+ # Perform sentiment analysis
16
+ result = sentiment_pipeline(user_input)
17
+ # Display results
18
+ st.write("Sentiment:", result[0]['label'])
19
+ st.write("Confidence:", result[0]['score'])