davidlee1102
Add user feedback
6911d6a
raw
history blame
916 Bytes
import streamlit as st
from emotion_model import emotion_predict
from transformers import logging
from datetime import datetime
# Enable logging
logging.set_verbosity_info()
name = st.text_input("Enter your sentence here")
if (st.button('Submit')):
result = name.title()
try:
result_check = emotion_predict(result)
except Exception as E:
result_check = "Error"
print(E)
st.success(result_check)
user_response = st.text_input("Please give your emotion that you are thinking is correct")
if (st.button('Submit Feedback')):
if user_response:
st.success("Thank you for contributing")
logging.set_verbosity_info()
logging.info(f"{result}, {result_check}, {user_response}, {datetime.now()}")
else:
st.success("Thank you for using")
logging.set_verbosity_info()
logging.info(f"{result}, {result_check}, {datetime.now()}")