maria355 commited on
Commit
4e7543f
·
verified ·
1 Parent(s): e8282b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -48
app.py CHANGED
@@ -1131,85 +1131,135 @@ def add_agentic_ai_info():
1131
  def create_chatbot():
1132
  """Create the Gradio interface for the chatbot"""
1133
  # Generate a random session ID for the user
 
1134
  session_id = str(uuid.uuid4())
1135
 
1136
- # Define theme colors and styling
1137
- primary_color = "#4a6fa5"
1138
- secondary_color = "#6c757d"
1139
- success_color = "#28a745"
1140
- light_color = "#f8f9fa"
1141
- dark_color = "#343a40"
1142
-
1143
- custom_css = f"""
1144
- :root {{
1145
- --primary-color: {primary_color};
1146
- --secondary-color: {secondary_color};
1147
- --success-color: {success_color};
1148
- --light-color: {light_color};
1149
- --dark-color: {dark_color};
1150
- }}
1151
- .gradio-container {{
1152
- background-color: var(--light-color);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1153
  font-family: 'Inter', 'Segoe UI', sans-serif;
1154
- }}
1155
- #title {{
 
 
1156
  font-size: 32px;
1157
  font-weight: bold;
1158
  text-align: center;
1159
  padding-top: 20px;
1160
  color: var(--primary-color);
1161
  margin-bottom: 0;
1162
- }}
1163
- #subtitle {{
 
1164
  font-size: 18px;
1165
  text-align: center;
1166
  margin-bottom: 20px;
1167
- color: var(--secondary-color);
1168
- }}
1169
- .card {{
1170
- background-color: white;
 
1171
  padding: 20px;
1172
  border-radius: 12px;
1173
- box-shadow: 0 4px 10px rgba(0,0,0,0.08);
1174
  margin-bottom: 20px;
1175
- }}
1176
- .tabs {{
 
 
1177
  margin-top: 20px;
1178
- }}
1179
- .gr-button-primary {{
 
1180
  background-color: var(--primary-color) !important;
1181
- }}
1182
- .gr-button-secondary {{
 
1183
  background-color: var(--secondary-color) !important;
1184
- }}
1185
- .gr-button-success {{
 
1186
  background-color: var(--success-color) !important;
1187
- }}
1188
- .footer {{
 
1189
  text-align: center;
1190
  margin-top: 30px;
1191
  padding: 10px;
1192
  font-size: 14px;
1193
- color: var(--secondary-color);
1194
- }}
1195
- .progress-module {{
 
1196
  padding: 10px;
1197
  margin: 5px 0;
1198
  border-radius: 5px;
1199
- background-color: #e9ecef;
1200
- }}
1201
- .progress-module.completed {{
1202
- background-color: #d4edda;
1203
- }}
1204
- .info-box {{
1205
- background-color: #e7f5fe;
 
 
 
1206
  border-left: 4px solid var(--primary-color);
1207
  padding: 15px;
1208
  margin: 15px 0;
1209
  border-radius: 4px;
1210
- }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1211
  """
1212
-
1213
  with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="blue")) as demo:
1214
  gr.HTML("<div id='title'>🎓 AI Teaching Assistant</div>")
1215
  gr.HTML("<div id='subtitle'>Your personalized learning companion for Python, Data Science & AI</div>")
 
1131
  def create_chatbot():
1132
  """Create the Gradio interface for the chatbot"""
1133
  # Generate a random session ID for the user
1134
+ import uuid
1135
  session_id = str(uuid.uuid4())
1136
 
1137
+ # Define theme colors and styling with support for both light and dark themes
1138
+ custom_css = """
1139
+ :root {
1140
+ /* Light theme variables (default) */
1141
+ --background-color: #f8f9fa;
1142
+ --card-background: #ffffff;
1143
+ --text-color: #343a40;
1144
+ --secondary-text-color: #6c757d;
1145
+ --primary-color: #4a6fa5;
1146
+ --secondary-color: #6c757d;
1147
+ --success-color: #28a745;
1148
+ --border-color: #dee2e6;
1149
+ --shadow-color: rgba(0,0,0,0.08);
1150
+ --info-background: #e7f5fe;
1151
+ --progress-background: #e9ecef;
1152
+ --completed-background: #d4edda;
1153
+ }
1154
+
1155
+ /* Dark theme preferences */
1156
+ @media (prefers-color-scheme: dark) {
1157
+ :root {
1158
+ --background-color: #121212;
1159
+ --card-background: #1e1e1e;
1160
+ --text-color: #e0e0e0;
1161
+ --secondary-text-color: #adb5bd;
1162
+ --primary-color: #5d87c6; /* Lighter shade for dark mode */
1163
+ --secondary-color: #8b959e;
1164
+ --success-color: #3cb054;
1165
+ --border-color: #495057;
1166
+ --shadow-color: rgba(0,0,0,0.2);
1167
+ --info-background: #2b3f54;
1168
+ --progress-background: #343a40;
1169
+ --completed-background: #255c33;
1170
+ }
1171
+ }
1172
+
1173
+ .gradio-container {
1174
+ background-color: var(--background-color);
1175
  font-family: 'Inter', 'Segoe UI', sans-serif;
1176
+ color: var(--text-color);
1177
+ }
1178
+
1179
+ #title {
1180
  font-size: 32px;
1181
  font-weight: bold;
1182
  text-align: center;
1183
  padding-top: 20px;
1184
  color: var(--primary-color);
1185
  margin-bottom: 0;
1186
+ }
1187
+
1188
+ #subtitle {
1189
  font-size: 18px;
1190
  text-align: center;
1191
  margin-bottom: 20px;
1192
+ color: var(--secondary-text-color);
1193
+ }
1194
+
1195
+ .card {
1196
+ background-color: var(--card-background);
1197
  padding: 20px;
1198
  border-radius: 12px;
1199
+ box-shadow: 0 4px 10px var(--shadow-color);
1200
  margin-bottom: 20px;
1201
+ color: var(--text-color);
1202
+ }
1203
+
1204
+ .tabs {
1205
  margin-top: 20px;
1206
+ }
1207
+
1208
+ .gr-button-primary {
1209
  background-color: var(--primary-color) !important;
1210
+ }
1211
+
1212
+ .gr-button-secondary {
1213
  background-color: var(--secondary-color) !important;
1214
+ }
1215
+
1216
+ .gr-button-success {
1217
  background-color: var(--success-color) !important;
1218
+ }
1219
+
1220
+ .footer {
1221
  text-align: center;
1222
  margin-top: 30px;
1223
  padding: 10px;
1224
  font-size: 14px;
1225
+ color: var(--secondary-text-color);
1226
+ }
1227
+
1228
+ .progress-module {
1229
  padding: 10px;
1230
  margin: 5px 0;
1231
  border-radius: 5px;
1232
+ background-color: var(--progress-background);
1233
+ color: var(--text-color);
1234
+ }
1235
+
1236
+ .progress-module.completed {
1237
+ background-color: var(--completed-background);
1238
+ }
1239
+
1240
+ .info-box {
1241
+ background-color: var(--info-background);
1242
  border-left: 4px solid var(--primary-color);
1243
  padding: 15px;
1244
  margin: 15px 0;
1245
  border-radius: 4px;
1246
+ color: var(--text-color);
1247
+ }
1248
+
1249
+ /* Ensure contrast for Markdown content */
1250
+ .markdown p, .markdown h1, .markdown h2, .markdown h3, .markdown h4 {
1251
+ color: var(--text-color) !important;
1252
+ }
1253
+
1254
+ .markdown a {
1255
+ color: var(--primary-color) !important;
1256
+ }
1257
+
1258
+ .markdown code {
1259
+ background-color: var(--progress-background) !important;
1260
+ color: var(--text-color) !important;
1261
+ }
1262
  """
 
1263
  with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="blue")) as demo:
1264
  gr.HTML("<div id='title'>🎓 AI Teaching Assistant</div>")
1265
  gr.HTML("<div id='subtitle'>Your personalized learning companion for Python, Data Science & AI</div>")