Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
# Streamlit interface with improved aesthetics
|
4 |
st.set_page_config(page_title="Chatbot Interface", page_icon="🤖")
|
@@ -8,25 +9,59 @@ def chatbot_response(user_input):
|
|
8 |
response = qa.run(user_input)
|
9 |
return response
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Create columns for logos
|
13 |
col1, col2, col3 = st.columns([2, 3, 2])
|
14 |
|
15 |
with col1:
|
16 |
-
st.image("Design 3_22.png", width=
|
17 |
-
|
18 |
|
19 |
with col3:
|
20 |
-
st.image("Altereo logo 2023 original - eau et territoires durables.png", width=
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
23 |
# Input and button for user interaction
|
24 |
-
user_input = st.text_input("You:", "")
|
25 |
-
submit_button = st.button("Send 📨")
|
26 |
|
27 |
-
|
28 |
-
if
|
29 |
-
if user_input.strip() != "":
|
30 |
bot_response = chatbot_response(user_input)
|
31 |
st.markdown("### You:")
|
32 |
st.markdown(f"> {user_input}")
|
@@ -37,4 +72,33 @@ if submit_button:
|
|
37 |
|
38 |
# Motivational quote at the bottom
|
39 |
st.markdown("---")
|
40 |
-
st.markdown("*La collaboration est la clé du succès. Chaque question trouve sa réponse, chaque défi devient une opportunité.*")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
|
4 |
# Streamlit interface with improved aesthetics
|
5 |
st.set_page_config(page_title="Chatbot Interface", page_icon="🤖")
|
|
|
9 |
response = qa.run(user_input)
|
10 |
return response
|
11 |
|
12 |
+
# Custom CSS for dark mode and centering
|
13 |
+
st.markdown(
|
14 |
+
"""
|
15 |
+
<style>
|
16 |
+
body {
|
17 |
+
background-color: #1e1e1e;
|
18 |
+
color: #ffffff;
|
19 |
+
}
|
20 |
+
.stButton button {
|
21 |
+
background-color: #4CAF50;
|
22 |
+
color: white;
|
23 |
+
}
|
24 |
+
.stTextInput input {
|
25 |
+
background-color: #333333;
|
26 |
+
color: white;
|
27 |
+
}
|
28 |
+
.center-text {
|
29 |
+
text-align: center;
|
30 |
+
}
|
31 |
+
.input-container {
|
32 |
+
display: flex;
|
33 |
+
align-items: center;
|
34 |
+
margin-bottom: 20px;
|
35 |
+
}
|
36 |
+
.input-container img {
|
37 |
+
margin-right: 10px;
|
38 |
+
}
|
39 |
+
.input-container input {
|
40 |
+
flex-grow: 1;
|
41 |
+
}
|
42 |
+
</style>
|
43 |
+
""",
|
44 |
+
unsafe_allow_html=True
|
45 |
+
)
|
46 |
|
47 |
# Create columns for logos
|
48 |
col1, col2, col3 = st.columns([2, 3, 2])
|
49 |
|
50 |
with col1:
|
51 |
+
st.image("Design 3_22.png", width=150, use_column_width=True) # Adjust image path and size as needed
|
|
|
52 |
|
53 |
with col3:
|
54 |
+
st.image("Altereo logo 2023 original - eau et territoires durables.png", width=150, use_column_width=True) # Adjust image path and size as needed
|
55 |
+
|
56 |
+
# Centered title and slogan
|
57 |
+
st.markdown('<h3 class="center-text">🤖 ALTER-IA BOT,</h3>', unsafe_allow_html=True)
|
58 |
+
st.markdown('<h4 class="center-text">Votre Réponse à Chaque Défi Méthodologique 📈</h4>', unsafe_allow_html=True)
|
59 |
+
|
60 |
# Input and button for user interaction
|
61 |
+
user_input = st.text_input("You:", "", placeholder="Type your question here...")
|
|
|
62 |
|
63 |
+
if st.button("Send 📨"):
|
64 |
+
if user_input.strip():
|
|
|
65 |
bot_response = chatbot_response(user_input)
|
66 |
st.markdown("### You:")
|
67 |
st.markdown(f"> {user_input}")
|
|
|
72 |
|
73 |
# Motivational quote at the bottom
|
74 |
st.markdown("---")
|
75 |
+
st.markdown("*La collaboration est la clé du succès. Chaque question trouve sa réponse, chaque défi devient une opportunité.*")
|
76 |
+
|
77 |
+
# Display icons and text input/output
|
78 |
+
user_icon = "path/to/user_icon.png" # Replace with your user icon path
|
79 |
+
bot_icon = "path/to/bot_icon.png" # Replace with your bot icon path
|
80 |
+
|
81 |
+
# Input field with icon
|
82 |
+
st.markdown(
|
83 |
+
f"""
|
84 |
+
<div class="input-container">
|
85 |
+
<img src="{user_icon}" alt="User Icon" width="30">
|
86 |
+
<input type="text" placeholder="Type your question here..." style="flex-grow: 1; background-color: #333333; color: white; padding: 10px; border: none; border-radius: 5px;">
|
87 |
+
</div>
|
88 |
+
""",
|
89 |
+
unsafe_allow_html=True
|
90 |
+
)
|
91 |
+
|
92 |
+
# Output field with icon
|
93 |
+
if submit_button:
|
94 |
+
if user_input.strip() != "":
|
95 |
+
bot_response = chatbot_response(user_input)
|
96 |
+
st.markdown(
|
97 |
+
f"""
|
98 |
+
<div class="input-container">
|
99 |
+
<img src="{bot_icon}" alt="Bot Icon" width="30">
|
100 |
+
<textarea style="flex-grow: 1; background-color: #333333; color: white; padding: 10px; border: none; border-radius: 5px;" rows="5">{bot_response}</textarea>
|
101 |
+
</div>
|
102 |
+
""",
|
103 |
+
unsafe_allow_html=True
|
104 |
+
)
|