Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -90,6 +90,19 @@ def save_feedback(question, response, rating, comment):
|
|
90 |
except Exception as e:
|
91 |
st.error(f"Error saving feedback: {e}")
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# Create columns for logos
|
94 |
col1, col2, col3 = st.columns([2, 3, 2])
|
95 |
|
@@ -114,32 +127,4 @@ st.markdown("""
|
|
114 |
|
115 |
# Center and color text
|
116 |
st.markdown('<h3 class="centered-text">🤖 AlteriaChat 🤖 </h3>', unsafe_allow_html=True)
|
117 |
-
st.markdown('<p class="centered-orange-text">
|
118 |
-
|
119 |
-
# Input and button for user interaction
|
120 |
-
user_input = st.text_input("You:", "")
|
121 |
-
submit_button = st.button("Ask 📨")
|
122 |
-
|
123 |
-
if submit_button:
|
124 |
-
if user_input.strip() != "":
|
125 |
-
bot_response = chatbot_response(user_input)
|
126 |
-
st.markdown("### Bot:")
|
127 |
-
st.text_area("", value=bot_response, height=600)
|
128 |
-
|
129 |
-
# Feedback Section
|
130 |
-
st.markdown("### Évaluation de la réponse")
|
131 |
-
rating = st.slider("Rating (1 to 5)", 1, 5, 3)
|
132 |
-
comment = st.text_area("Your comment:", "")
|
133 |
-
|
134 |
-
if st.button("Submit Feedback"):
|
135 |
-
if comment.strip() != "":
|
136 |
-
save_feedback(user_input, bot_response, rating, comment)
|
137 |
-
else:
|
138 |
-
st.warning("⚠️ Please enter a comment.")
|
139 |
-
|
140 |
-
else:
|
141 |
-
st.warning("⚠️ Please enter a message.")
|
142 |
-
|
143 |
-
# Motivational quote at the bottom
|
144 |
-
st.markdown("---")
|
145 |
-
st.markdown("La collaboration est la clé du succès. Chaque question trouve sa réponse, chaque défi devient une opportunité.")
|
|
|
90 |
except Exception as e:
|
91 |
st.error(f"Error saving feedback: {e}")
|
92 |
|
93 |
+
# Use session state to store user input, bot response, rating, and comment
|
94 |
+
if 'user_input' not in st.session_state:
|
95 |
+
st.session_state.user_input = ""
|
96 |
+
|
97 |
+
if 'bot_response' not in st.session_state:
|
98 |
+
st.session_state.bot_response = ""
|
99 |
+
|
100 |
+
if 'rating' not in st.session_state:
|
101 |
+
st.session_state.rating = 3 # Default rating
|
102 |
+
|
103 |
+
if 'comment' not in st.session_state:
|
104 |
+
st.session_state.comment = ""
|
105 |
+
|
106 |
# Create columns for logos
|
107 |
col1, col2, col3 = st.columns([2, 3, 2])
|
108 |
|
|
|
127 |
|
128 |
# Center and color text
|
129 |
st.markdown('<h3 class="centered-text">🤖 AlteriaChat 🤖 </h3>', unsafe_allow_html=True)
|
130 |
+
st.markdown('<p class="centered-orange-text">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|