Upload 2 files
Browse files- RAG_streamlit_app.py +2 -1
- requirements.txt +2 -1
RAG_streamlit_app.py
CHANGED
|
@@ -3,6 +3,7 @@ from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM, AutoMod
|
|
| 3 |
from sentence_transformers import SentenceTransformer
|
| 4 |
import faiss, pickle
|
| 5 |
from PIL import Image
|
|
|
|
| 6 |
|
| 7 |
tokenizer = AutoTokenizer.from_pretrained("sentiment_model")
|
| 8 |
model = AutoModelForSequenceClassification.from_pretrained("sentiment_model")
|
|
@@ -36,7 +37,7 @@ def explain_sentiment(text, predicted_label, k=3):
|
|
| 36 |
return {"retrieved": retrieved, "explanation": explanation}
|
| 37 |
|
| 38 |
st.title("Sentiment Analyzer")
|
| 39 |
-
image = Image.open(
|
| 40 |
st.image(image, width='stretch')
|
| 41 |
text = st.text_area("Enter text to analyze:")
|
| 42 |
if st.button("Predict"):
|
|
|
|
| 3 |
from sentence_transformers import SentenceTransformer
|
| 4 |
import faiss, pickle
|
| 5 |
from PIL import Image
|
| 6 |
+
import os
|
| 7 |
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained("sentiment_model")
|
| 9 |
model = AutoModelForSequenceClassification.from_pretrained("sentiment_model")
|
|
|
|
| 37 |
return {"retrieved": retrieved, "explanation": explanation}
|
| 38 |
|
| 39 |
st.title("Sentiment Analyzer")
|
| 40 |
+
image = Image.open("Social-Sentiment-Tracking.png")
|
| 41 |
st.image(image, width='stretch')
|
| 42 |
text = st.text_area("Enter text to analyze:")
|
| 43 |
if st.button("Predict"):
|
requirements.txt
CHANGED
|
@@ -3,4 +3,5 @@ transformers
|
|
| 3 |
sentence-transformers
|
| 4 |
faiss-cpu
|
| 5 |
torch
|
| 6 |
-
pillow
|
|
|
|
|
|
| 3 |
sentence-transformers
|
| 4 |
faiss-cpu
|
| 5 |
torch
|
| 6 |
+
pillow
|
| 7 |
+
os
|