Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,9 @@ st.title("📚 Subject-specific AI Chatbot")
|
|
15 |
st.write("Hello! I'm your AI Study Assistant. You can ask me any questions related to your subjects, and I'll try to help.")
|
16 |
|
17 |
# Add sidebar with styling options
|
18 |
-
st.sidebar.header("Settings")
|
19 |
st.sidebar.write("Customize your chatbot experience!")
|
20 |
-
chat_theme = st.sidebar.radio("Choose a theme:", ["Light", "Dark"])
|
21 |
|
22 |
# Apply theme
|
23 |
if chat_theme == "Dark":
|
@@ -25,6 +25,23 @@ if chat_theme == "Dark":
|
|
25 |
<style>
|
26 |
body {background-color: #1e1e1e; color: white;}
|
27 |
.stButton>button {background-color: #4CAF50; color: white;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</style>
|
29 |
""", unsafe_allow_html=True)
|
30 |
else:
|
@@ -32,6 +49,7 @@ else:
|
|
32 |
<style>
|
33 |
body {background-color: #ffffff; color: black;}
|
34 |
.stButton>button {background-color: #008CBA; color: white;}
|
|
|
35 |
</style>
|
36 |
""", unsafe_allow_html=True)
|
37 |
|
@@ -84,5 +102,5 @@ if user_input:
|
|
84 |
st.markdown("---")
|
85 |
st.markdown("### 🗨️ Chat History")
|
86 |
for question, answer in st.session_state.conversation_history:
|
87 |
-
st.write(f"
|
88 |
-
st.write(answer)
|
|
|
15 |
st.write("Hello! I'm your AI Study Assistant. You can ask me any questions related to your subjects, and I'll try to help.")
|
16 |
|
17 |
# Add sidebar with styling options
|
18 |
+
st.sidebar.header("⚙️ Settings")
|
19 |
st.sidebar.write("Customize your chatbot experience!")
|
20 |
+
chat_theme = st.sidebar.radio("Choose a theme:", ["Light", "Dark", "Blue", "Green"])
|
21 |
|
22 |
# Apply theme
|
23 |
if chat_theme == "Dark":
|
|
|
25 |
<style>
|
26 |
body {background-color: #1e1e1e; color: white;}
|
27 |
.stButton>button {background-color: #4CAF50; color: white;}
|
28 |
+
.chat-bubble {background-color: #2c2c2c; border-radius: 10px; padding: 10px;}
|
29 |
+
</style>
|
30 |
+
""", unsafe_allow_html=True)
|
31 |
+
elif chat_theme == "Blue":
|
32 |
+
st.markdown("""
|
33 |
+
<style>
|
34 |
+
body {background-color: #e3f2fd; color: black;}
|
35 |
+
.stButton>button {background-color: #2196F3; color: white;}
|
36 |
+
.chat-bubble {background-color: #bbdefb; border-radius: 10px; padding: 10px;}
|
37 |
+
</style>
|
38 |
+
""", unsafe_allow_html=True)
|
39 |
+
elif chat_theme == "Green":
|
40 |
+
st.markdown("""
|
41 |
+
<style>
|
42 |
+
body {background-color: #e8f5e9; color: black;}
|
43 |
+
.stButton>button {background-color: #4CAF50; color: white;}
|
44 |
+
.chat-bubble {background-color: #c8e6c9; border-radius: 10px; padding: 10px;}
|
45 |
</style>
|
46 |
""", unsafe_allow_html=True)
|
47 |
else:
|
|
|
49 |
<style>
|
50 |
body {background-color: #ffffff; color: black;}
|
51 |
.stButton>button {background-color: #008CBA; color: white;}
|
52 |
+
.chat-bubble {background-color: #f1f1f1; border-radius: 10px; padding: 10px;}
|
53 |
</style>
|
54 |
""", unsafe_allow_html=True)
|
55 |
|
|
|
102 |
st.markdown("---")
|
103 |
st.markdown("### 🗨️ Chat History")
|
104 |
for question, answer in st.session_state.conversation_history:
|
105 |
+
st.write(f"<div class='chat-bubble'><b>{question}</b></div>", unsafe_allow_html=True)
|
106 |
+
st.write(f"<div class='chat-bubble'>{answer}</div>", unsafe_allow_html=True)
|