rararara9999 commited on
Commit
c32e852
·
verified ·
1 Parent(s): 35443a7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ def main():
4
+ sentiment_pipeline = pipeline(model=microsoft/resnet-50)
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
+
13
+ st.write(f"Sentiment: {sentiment}")
14
+ st.write(f"Confidence: {confidence:.2f}")
15
+ if __name__ == "__main__":
16
+ main()
17
+
18
+