Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,9 @@ client = MongoClient("mongodb+srv://Savir:savir2010@m0-savir.8iqdy.mongodb.net/?
|
|
5 |
|
6 |
db = client['sentiment-db']
|
7 |
collection = db['sentiment-collection']
|
8 |
-
results = collection.find({"name":'savir'})
|
9 |
-
for result in results:
|
10 |
-
|
11 |
-
exit()
|
12 |
from peft import PeftModel, PeftConfig
|
13 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
14 |
import torch
|
@@ -37,4 +36,6 @@ predictions = torch.max(logits,1).indices
|
|
37 |
if st.button("Calculate Sentiment"):
|
38 |
with st.chat_message("assistant"):
|
39 |
response = "The Following Text " + f'"{review}" is ' + id2label[predictions.tolist()[0]]
|
|
|
|
|
40 |
st.markdown(response)
|
|
|
5 |
|
6 |
db = client['sentiment-db']
|
7 |
collection = db['sentiment-collection']
|
8 |
+
# results = collection.find({"name":'savir'})
|
9 |
+
# for result in results:
|
10 |
+
# st.markdown(f"{result}")
|
|
|
11 |
from peft import PeftModel, PeftConfig
|
12 |
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
13 |
import torch
|
|
|
36 |
if st.button("Calculate Sentiment"):
|
37 |
with st.chat_message("assistant"):
|
38 |
response = "The Following Text " + f'"{review}" is ' + id2label[predictions.tolist()[0]]
|
39 |
+
response_dict = {review:id2label[predictions.tolist()[0]]}
|
40 |
+
response_db = collection.insert_one(response_dict)
|
41 |
st.markdown(response)
|