SavirD commited on
Commit
8843769
1 Parent(s): 492e26e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -1,5 +1,7 @@
1
  from pymongo import MongoClient
2
  import streamlit as st
 
 
3
 
4
  client = MongoClient("mongodb+srv://Savir:[email protected]/?retryWrites=true&w=majority&appName=M0-Savir",tlsAllowInvalidCertificates=True)
5
 
@@ -36,6 +38,7 @@ predictions = torch.max(logits,1).indices
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)
 
1
  from pymongo import MongoClient
2
  import streamlit as st
3
+ from datetime import datetime
4
+
5
 
6
  client = MongoClient("mongodb+srv://Savir:[email protected]/?retryWrites=true&w=majority&appName=M0-Savir",tlsAllowInvalidCertificates=True)
7
 
 
38
  if st.button("Calculate Sentiment"):
39
  with st.chat_message("assistant"):
40
  response = "The Following Text " + f'"{review}" is ' + id2label[predictions.tolist()[0]]
41
+ current_time = datetime.now().time()
42
+ response_dict = {f"{current_time}":{f"{review}":id2label[predictions.tolist()[0]]}}
43
  response_db = collection.insert_one(response_dict)
44
  st.markdown(response)