Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,6 @@ Answer in french only
|
|
41 |
|
42 |
{context}
|
43 |
Vous devez répondre aux questions en français.
|
44 |
-
|
45 |
### QUESTION:
|
46 |
{question}
|
47 |
[/INST]
|
@@ -61,7 +60,7 @@ prompt = PromptTemplate(
|
|
61 |
template=prompt_template,
|
62 |
)
|
63 |
|
64 |
-
# Create
|
65 |
llm_chain = LLMChain(llm=mistral_llm, prompt=prompt)
|
66 |
|
67 |
# Create RetrievalQA chain
|
@@ -95,13 +94,6 @@ st.markdown("""
|
|
95 |
.centered-text {
|
96 |
text-align: center;
|
97 |
}
|
98 |
-
</style>
|
99 |
-
""", unsafe_allow_html=True)
|
100 |
-
|
101 |
-
# Utiliser la classe CSS pour centrer et colorer le texte
|
102 |
-
st.markdown('<h3 class="centered-text">🤖 AlteriaChat 🤖 </h3>', unsafe_allow_html=True)
|
103 |
-
st.markdown("""
|
104 |
-
<style>
|
105 |
.centered-orange-text {
|
106 |
text-align: center;
|
107 |
color: darkorange;
|
@@ -109,52 +101,33 @@ st.markdown("""
|
|
109 |
</style>
|
110 |
""", unsafe_allow_html=True)
|
111 |
|
112 |
-
#
|
|
|
113 |
st.markdown('<p class="centered-orange-text">"Votre Réponse à Chaque Défi Méthodologique "</p>', unsafe_allow_html=True)
|
114 |
|
115 |
# Input and button for user interaction
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
user_input = st.text_input("You:")
|
143 |
-
bot_response = "This is a bot response." # Replace this with your chatbot's response logic
|
144 |
-
|
145 |
-
st.markdown("### Rate the response:")
|
146 |
-
rating = st.selectbox("", [1, 2, 3, 4, 5])
|
147 |
-
|
148 |
-
st.markdown("### Leave a comment:")
|
149 |
-
comment = st.text_area("")
|
150 |
-
|
151 |
-
if st.button("Submit"):
|
152 |
-
if user_input.strip() and comment.strip():
|
153 |
-
save_feedback(user_input, bot_response, rating, comment)
|
154 |
-
st.success("Thank you for your feedback!")
|
155 |
-
else:
|
156 |
-
st.warning("Please provide both input and comment.")
|
157 |
-
|
158 |
-
st.markdown("---")
|
159 |
-
st.markdown("Collaboration is the key to success. Each question finds its answer, each challenge becomes an opportunity.")
|
160 |
-
|
|
|
41 |
|
42 |
{context}
|
43 |
Vous devez répondre aux questions en français.
|
|
|
44 |
### QUESTION:
|
45 |
{question}
|
46 |
[/INST]
|
|
|
60 |
template=prompt_template,
|
61 |
)
|
62 |
|
63 |
+
# Create LLM chain
|
64 |
llm_chain = LLMChain(llm=mistral_llm, prompt=prompt)
|
65 |
|
66 |
# Create RetrievalQA chain
|
|
|
94 |
.centered-text {
|
95 |
text-align: center;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
.centered-orange-text {
|
98 |
text-align: center;
|
99 |
color: darkorange;
|
|
|
101 |
</style>
|
102 |
""", unsafe_allow_html=True)
|
103 |
|
104 |
+
# Use CSS classes to style the text
|
105 |
+
st.markdown('<h3 class="centered-text">🤖 AlteriaChat 🤖 </h3>', unsafe_allow_html=True)
|
106 |
st.markdown('<p class="centered-orange-text">"Votre Réponse à Chaque Défi Méthodologique "</p>', unsafe_allow_html=True)
|
107 |
|
108 |
# Input and button for user interaction
|
109 |
+
with st.form(key='interaction_form'):
|
110 |
+
user_input = st.text_input("You:", key="user_input")
|
111 |
+
submit_button = st.form_submit_button("Ask 📨")
|
112 |
+
|
113 |
+
if submit_button and user_input.strip():
|
114 |
+
bot_response = chatbot_response(user_input)
|
115 |
+
st.markdown("### Bot:")
|
116 |
+
st.text_area("", value=bot_response, height=600)
|
117 |
+
|
118 |
+
# Feedback form
|
119 |
+
st.markdown("### Rate the response:")
|
120 |
+
rating = st.slider("Select a rating:", min_value=1, max_value=5, value=1, key="rating")
|
121 |
+
|
122 |
+
st.markdown("### Leave a comment:")
|
123 |
+
comment = st.text_area("", key="comment")
|
124 |
+
|
125 |
+
# Feedback submission
|
126 |
+
feedback_submit_button = st.form_submit_button("Submit Feedback")
|
127 |
+
|
128 |
+
if feedback_submit_button:
|
129 |
+
if comment.strip():
|
130 |
+
save_feedback(user_input, bot_response, rating, comment)
|
131 |
+
st.success("Thank you for your feedback!")
|
132 |
+
else:
|
133 |
+
st.warning("⚠️ Please provide a comment.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|