Jayabaskar commited on
Commit
d63e292
·
verified ·
1 Parent(s): 24f3093

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load model from Hugging Face
5
+ @st.cache_resource
6
+ def load_model():
7
+ return pipeline("text-classification", model="Jayabaskar/Fintuned") # Use your uploaded model
8
+
9
+ model = load_model()
10
+
11
+ st.title("Twitter Sentiment Analysis")
12
+ text = st.text_area("Enter a tweet:")
13
+
14
+ if st.button("Analyze"):
15
+ if text.strip():
16
+ with st.spinner("Analyzing..."):
17
+ result = model(text)
18
+ st.success(f"**Sentiment:** {result[0]['label']} (Score: {result[0]['score']:.2f})")
19
+ else:
20
+ st.warning("Please enter some text.")