Emily666666 commited on
Commit
659ac69
1 Parent(s): f46161b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ def main():
4
+ sentiment_pipeline = pipeline("sentiment-analysis")
5
+ st.title("Sentiment Analysis with HuggingFace Spaces")
6
+ st.write("Enter a sentence to analyze its sentiment:")
7
+ user_input = st.text_input("")
8
+ if user_input:
9
+ result = sentiment_pipeline(user_input)
10
+ sentiment = result[0]["label"]
11
+ confidence = result[0]["score"]
12
+ st.write(f"Sentiment: {sentiment}")
13
+ st.write(f"Confidence: {confidence:.2f}")
14
+ if __name__ == "__main__":
15
+ main()