Update app.py
Browse files
app.py
CHANGED
@@ -6,17 +6,16 @@ import time
|
|
6 |
# Set page configuration as the first Streamlit command
|
7 |
st.set_page_config(page_title="Evo", page_icon="π€", layout="wide")
|
8 |
|
9 |
-
# Advanced CSS for
|
10 |
st.markdown("""
|
11 |
<style>
|
12 |
-
/* Global Styles
|
13 |
body {
|
14 |
font-family: 'Arial', sans-serif;
|
15 |
-
background-color: #
|
16 |
}
|
17 |
.stApp {
|
18 |
-
background-color: #
|
19 |
-
color: #d8dee9;
|
20 |
}
|
21 |
|
22 |
/* Chat Container */
|
@@ -25,45 +24,45 @@ st.markdown("""
|
|
25 |
overflow-y: auto;
|
26 |
border-radius: 15px;
|
27 |
padding: 20px;
|
28 |
-
background: linear-gradient(135deg, #
|
29 |
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.
|
30 |
margin: 20px 0;
|
31 |
}
|
32 |
|
33 |
/* Messages */
|
34 |
.user-message {
|
35 |
background: #4a90e2;
|
36 |
-
color:
|
37 |
padding: 12px 18px;
|
38 |
border-radius: 15px 15px 0 15px;
|
39 |
margin: 10px 0;
|
40 |
max-width: 70%;
|
41 |
align-self: flex-end;
|
42 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.
|
43 |
}
|
44 |
.assistant-message {
|
45 |
-
background: #
|
46 |
-
color: #
|
47 |
padding: 12px 18px;
|
48 |
border-radius: 15px 15px 15px 0;
|
49 |
margin: 10px 0;
|
50 |
max-width: 70%;
|
51 |
align-self: flex-start;
|
52 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.
|
53 |
}
|
54 |
|
55 |
/* Sidebar */
|
56 |
.sidebar .sidebar-content {
|
57 |
-
background: #
|
58 |
-
color:
|
59 |
border-radius: 10px;
|
60 |
padding: 20px;
|
61 |
}
|
62 |
.sidebar-btn {
|
63 |
width: 100%;
|
64 |
margin: 8px 0;
|
65 |
-
background: #
|
66 |
-
color:
|
67 |
border: none;
|
68 |
padding: 10px;
|
69 |
border-radius: 8px;
|
@@ -71,20 +70,20 @@ st.markdown("""
|
|
71 |
transition: background 0.3s ease;
|
72 |
}
|
73 |
.sidebar-btn:hover {
|
74 |
-
background: #
|
75 |
}
|
76 |
|
77 |
/* Title and Header */
|
78 |
.title {
|
79 |
font-size: 2.5em;
|
80 |
-
color: #
|
81 |
text-align: center;
|
82 |
margin-top: 20px;
|
83 |
-
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.
|
84 |
}
|
85 |
.subtitle {
|
86 |
font-size: 1.2em;
|
87 |
-
color: #
|
88 |
text-align: center;
|
89 |
margin-bottom: 30px;
|
90 |
}
|
@@ -93,14 +92,8 @@ st.markdown("""
|
|
93 |
.stTextInput > div > input {
|
94 |
border-radius: 20px;
|
95 |
padding: 10px 15px;
|
96 |
-
border: 1px solid #
|
97 |
-
|
98 |
-
color: #d8dee9;
|
99 |
-
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
|
100 |
-
}
|
101 |
-
.stTextInput > div > input:focus {
|
102 |
-
border-color: #5e81ac;
|
103 |
-
outline: none;
|
104 |
}
|
105 |
|
106 |
/* Feedback Buttons */
|
@@ -108,14 +101,12 @@ st.markdown("""
|
|
108 |
padding: 5px 10px;
|
109 |
margin: 5px;
|
110 |
border-radius: 50%;
|
111 |
-
background: #
|
112 |
-
color: #eceff4;
|
113 |
cursor: pointer;
|
114 |
transition: transform 0.2s ease;
|
115 |
}
|
116 |
.feedback-btn:hover {
|
117 |
transform: scale(1.1);
|
118 |
-
background: #5e81ac;
|
119 |
}
|
120 |
</style>
|
121 |
""", unsafe_allow_html=True)
|
@@ -154,11 +145,11 @@ if 'feedback' not in st.session_state:
|
|
154 |
|
155 |
# Application title and description
|
156 |
st.markdown('<h1 class="title">Evo: Your AI Networking Assistant π€</h1>', unsafe_allow_html=True)
|
157 |
-
st.markdown('<p class="subtitle">Explore networking topics
|
158 |
|
159 |
# Sidebar with advanced suggested questions
|
160 |
with st.sidebar:
|
161 |
-
st.markdown('<h2 style="color:
|
162 |
categories = {
|
163 |
"Basics": ["What is TCP/IP?", "How does DNS work?", "What is an IP address?"],
|
164 |
"Advanced": ["Explain VLANs", "What is SD-WAN?", "How does BGP work?"],
|
@@ -189,7 +180,7 @@ for i, message in enumerate(st.session_state.messages):
|
|
189 |
if st.button("π", key=f"down_{i}", help="Dislike this response", type="secondary"):
|
190 |
st.session_state.feedback[i] = "negative"
|
191 |
if i in st.session_state.feedback:
|
192 |
-
st
|
193 |
st.markdown('</div>', unsafe_allow_html=True)
|
194 |
|
195 |
# Function to handle queries (user input or suggestions)
|
|
|
6 |
# Set page configuration as the first Streamlit command
|
7 |
st.set_page_config(page_title="Evo", page_icon="π€", layout="wide")
|
8 |
|
9 |
+
# Advanced CSS for a polished UI
|
10 |
st.markdown("""
|
11 |
<style>
|
12 |
+
/* Global Styles */
|
13 |
body {
|
14 |
font-family: 'Arial', sans-serif;
|
15 |
+
background-color: #f5f6fa;
|
16 |
}
|
17 |
.stApp {
|
18 |
+
background-color: #f5f6fa;
|
|
|
19 |
}
|
20 |
|
21 |
/* Chat Container */
|
|
|
24 |
overflow-y: auto;
|
25 |
border-radius: 15px;
|
26 |
padding: 20px;
|
27 |
+
background: linear-gradient(135deg, #ffffff, #f0f2f5);
|
28 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
29 |
margin: 20px 0;
|
30 |
}
|
31 |
|
32 |
/* Messages */
|
33 |
.user-message {
|
34 |
background: #4a90e2;
|
35 |
+
color: white;
|
36 |
padding: 12px 18px;
|
37 |
border-radius: 15px 15px 0 15px;
|
38 |
margin: 10px 0;
|
39 |
max-width: 70%;
|
40 |
align-self: flex-end;
|
41 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
42 |
}
|
43 |
.assistant-message {
|
44 |
+
background: #eceff1;
|
45 |
+
color: #333;
|
46 |
padding: 12px 18px;
|
47 |
border-radius: 15px 15px 15px 0;
|
48 |
margin: 10px 0;
|
49 |
max-width: 70%;
|
50 |
align-self: flex-start;
|
51 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
52 |
}
|
53 |
|
54 |
/* Sidebar */
|
55 |
.sidebar .sidebar-content {
|
56 |
+
background: #2c3e50;
|
57 |
+
color: white;
|
58 |
border-radius: 10px;
|
59 |
padding: 20px;
|
60 |
}
|
61 |
.sidebar-btn {
|
62 |
width: 100%;
|
63 |
margin: 8px 0;
|
64 |
+
background: #3498db;
|
65 |
+
color: white;
|
66 |
border: none;
|
67 |
padding: 10px;
|
68 |
border-radius: 8px;
|
|
|
70 |
transition: background 0.3s ease;
|
71 |
}
|
72 |
.sidebar-btn:hover {
|
73 |
+
background: #2980b9;
|
74 |
}
|
75 |
|
76 |
/* Title and Header */
|
77 |
.title {
|
78 |
font-size: 2.5em;
|
79 |
+
color: #2c3e50;
|
80 |
text-align: center;
|
81 |
margin-top: 20px;
|
82 |
+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
|
83 |
}
|
84 |
.subtitle {
|
85 |
font-size: 1.2em;
|
86 |
+
color: #7f8c8d;
|
87 |
text-align: center;
|
88 |
margin-bottom: 30px;
|
89 |
}
|
|
|
92 |
.stTextInput > div > input {
|
93 |
border-radius: 20px;
|
94 |
padding: 10px 15px;
|
95 |
+
border: 1px solid #dcdcdc;
|
96 |
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
/* Feedback Buttons */
|
|
|
101 |
padding: 5px 10px;
|
102 |
margin: 5px;
|
103 |
border-radius: 50%;
|
104 |
+
background: #ecf0f1;
|
|
|
105 |
cursor: pointer;
|
106 |
transition: transform 0.2s ease;
|
107 |
}
|
108 |
.feedback-btn:hover {
|
109 |
transform: scale(1.1);
|
|
|
110 |
}
|
111 |
</style>
|
112 |
""", unsafe_allow_html=True)
|
|
|
145 |
|
146 |
# Application title and description
|
147 |
st.markdown('<h1 class="title">Evo: Your AI Networking Assistant π€</h1>', unsafe_allow_html=True)
|
148 |
+
st.markdown('<p class="subtitle">Explore networking topics with a cutting-edge AI companion</p>', unsafe_allow_html=True)
|
149 |
|
150 |
# Sidebar with advanced suggested questions
|
151 |
with st.sidebar:
|
152 |
+
st.markdown('<h2 style="color: white;">Suggested Questions</h2>', unsafe_allow_html=True)
|
153 |
categories = {
|
154 |
"Basics": ["What is TCP/IP?", "How does DNS work?", "What is an IP address?"],
|
155 |
"Advanced": ["Explain VLANs", "What is SD-WAN?", "How does BGP work?"],
|
|
|
180 |
if st.button("π", key=f"down_{i}", help="Dislike this response", type="secondary"):
|
181 |
st.session_state.feedback[i] = "negative"
|
182 |
if i in st.session_state.feedback:
|
183 |
+
st markdown(f'<p style="color: #7f8c8d; font-size: 0.9em;">Feedback: {"Liked" if st.session_state.feedback[i] == "positive" else "Disliked"}</p>', unsafe_allow_html=True)
|
184 |
st.markdown('</div>', unsafe_allow_html=True)
|
185 |
|
186 |
# Function to handle queries (user input or suggestions)
|