mahika123 commited on
Commit
67fc006
·
verified ·
1 Parent(s): 5176c0f
Files changed (1) hide show
  1. app.py +434 -40
app.py CHANGED
@@ -3,6 +3,8 @@ from huggingface_hub import InferenceClient
3
  from sentence_transformers import SentenceTransformer
4
  import torch
5
 
 
 
6
  # Theme
7
  theme = gr.themes.Soft(
8
  primary_hue="rose",
@@ -10,19 +12,25 @@ theme = gr.themes.Soft(
10
  neutral_hue="pink"
11
  )
12
 
 
 
13
  custom_css = """
14
  :root {
15
- --background-fill-primary: #FFB6C2 !important;
16
  }
17
  .dark {
18
- --background-fill-primary: #FFB6C1 !important;
19
  }
20
  """
21
 
 
 
22
  # Load research file
23
  with open("research.txt", "r", encoding="utf-8") as file:
24
  research_text = file.read()
25
 
 
 
26
  # Preprocess text
27
  def preprocess_text(text):
28
  cleaned_text = text.strip()
@@ -30,17 +38,27 @@ def preprocess_text(text):
30
  cleaned_chunks = [chunk.strip() for chunk in chunks if chunk.strip() != ""]
31
  return cleaned_chunks
32
 
 
 
33
  cleaned_chunks = preprocess_text(research_text)
34
 
 
 
35
  # Create embeddings
36
  model = SentenceTransformer('all-MiniLM-L6-v2')
37
 
 
 
38
  def create_embeddings(text_chunks):
39
  chunk_embeddings = model.encode(text_chunks, convert_to_tensor=True)
40
  return chunk_embeddings
41
 
 
 
42
  chunk_embeddings = create_embeddings(cleaned_chunks)
43
 
 
 
44
  # Get top chunks
45
  def get_top_chunks(query, chunk_embeddings, text_chunks):
46
  query_embedding = model.encode(query, convert_to_tensor=True)
@@ -51,9 +69,13 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
51
  top_chunks = [text_chunks[i] for i in top_indices]
52
  return top_chunks
53
 
 
 
54
  # Inference client
55
  client = InferenceClient("Qwen/Qwen2.5-72B-Instruct")
56
 
 
 
57
  def respond(message, history):
58
  top_results = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
59
  str_top_results = '\n'.join(top_results)
@@ -63,6 +85,9 @@ def respond(message, history):
63
  if history:
64
  messages.extend(history)
65
  messages.append({'role': 'user', 'content': message})
 
 
 
66
  response = client.chat_completion(
67
  messages,
68
  max_tokens=1000,
@@ -70,9 +95,13 @@ def respond(message, history):
70
  )
71
  return response['choices'][0]['message']['content'].strip()
72
 
 
 
73
  def display_image():
74
  return "KWKbanner.png"
75
 
 
 
76
  # Explore Page Info
77
  def show_info(topic):
78
  responses = {
@@ -84,53 +113,377 @@ def show_info(topic):
84
  }
85
  return responses.get(topic, "Select a category to see the corresponding careers.")
86
 
87
- # Embedded resource data directly here
88
- career_resources = {
89
- "Data Scientist": {
90
- "skills": [
91
- ("Python Basics", "https://www.learnpython.org/"),
92
- ("Kaggle for Practice", "https://www.kaggle.com/")
93
- ],
94
- "major": "Computer Science, Statistics, Data Science",
95
- "classes": ["Statistics", "Machine Learning", "Data Structures"],
96
- "youtube": "<iframe width='100%' height='315' src='https://www.youtube.com/embed/xC-c7E5PK0Y' frameborder='0' allowfullscreen></iframe>"
97
- },
98
- "Software Developer": {
99
- "skills": [
100
- ("W3Schools HTML/CSS", "https://www.w3schools.com/"),
101
- ("freeCodeCamp", "https://www.freecodecamp.org/")
102
- ],
103
- "major": "Computer Science, Software Engineering",
104
- "classes": ["Intro to Programming", "Operating Systems", "Algorithms"],
105
- "youtube": "<iframe width='100%' height='315' src='https://www.youtube.com/embed/bSrm9RXwBaI' frameborder='0' allowfullscreen></iframe>"
106
- },
107
- # Add more careers similarly...
108
- }
109
 
 
 
110
  def resource_block(career):
111
- content = career_resources.get(career)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  if not content:
113
  return "Select a career to see resources.", ""
114
 
115
- link_html = "<h4>🧠 Skills</h4><ul>"
116
- for label, url in content["skills"]:
117
- link_html += f"<li><strong>{label}</strong>: <a href='{url}' target='_blank'>{url}</a></li>"
118
- link_html += "</ul><br>"
119
 
120
- college_html = "<h4>🎓 College & Classes</h4><ul>"
121
- college_html += f"<li><strong>Majors:</strong> {content['major']}</li>"
122
- college_html += "<li><strong>Helpful Classes:</strong><ul>"
123
- for course in content["classes"]:
124
- college_html += f"<li>{course}</li>"
125
- college_html += "</ul></li></ul><hr>"
126
 
127
- video_embed = content.get("youtube", "")
128
- return link_html + "<br>" + college_html, video_embed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  # UI Layout
131
  with gr.Blocks(theme=theme, css=custom_css) as chatbot:
132
  gr.Image(display_image)
133
 
 
 
134
  with gr.Tab("ChatBot"):
135
  gr.ChatInterface(
136
  respond,
@@ -140,7 +493,12 @@ with gr.Blocks(theme=theme, css=custom_css) as chatbot:
140
  description='This tool provides information on STEM Careers. All information is sourced from [census.gov](https://www.census.gov/).'
141
  )
142
 
143
- with gr.Tab("Explore Now"):
 
 
 
 
 
144
  gr.Markdown("### Explore STEM Career Categories")
145
  dropdown_explore = gr.Dropdown(
146
  choices=[
@@ -153,16 +511,52 @@ with gr.Blocks(theme=theme, css=custom_css) as chatbot:
153
  label="Choose a Category"
154
  )
155
  output_explore = gr.Markdown()
 
 
 
156
  dropdown_explore.change(fn=show_info, inputs=dropdown_explore, outputs=output_explore)
157
 
 
 
 
 
 
158
  with gr.Tab("Resources"):
159
  gr.Markdown("### Career-Specific Educational Resources")
160
  dropdown_resources = gr.Dropdown(
161
- choices=list(career_resources.keys()),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  label="Choose a Career"
163
  )
164
  output_links = gr.HTML()
165
  output_video = gr.HTML()
166
- dropdown_resources.change(fn=resource_block, inputs=dropdown_resources, outputs=[output_links, output_video])
 
 
 
 
 
 
167
 
168
  chatbot.launch()
 
 
 
3
  from sentence_transformers import SentenceTransformer
4
  import torch
5
 
6
+
7
+
8
  # Theme
9
  theme = gr.themes.Soft(
10
  primary_hue="rose",
 
12
  neutral_hue="pink"
13
  )
14
 
15
+
16
+
17
  custom_css = """
18
  :root {
19
+ --background-fill-primary: #FFB6C2 !important;
20
  }
21
  .dark {
22
+ --background-fill-primary: #FFB6C1 !important;
23
  }
24
  """
25
 
26
+
27
+
28
  # Load research file
29
  with open("research.txt", "r", encoding="utf-8") as file:
30
  research_text = file.read()
31
 
32
+
33
+
34
  # Preprocess text
35
  def preprocess_text(text):
36
  cleaned_text = text.strip()
 
38
  cleaned_chunks = [chunk.strip() for chunk in chunks if chunk.strip() != ""]
39
  return cleaned_chunks
40
 
41
+
42
+
43
  cleaned_chunks = preprocess_text(research_text)
44
 
45
+
46
+
47
  # Create embeddings
48
  model = SentenceTransformer('all-MiniLM-L6-v2')
49
 
50
+
51
+
52
  def create_embeddings(text_chunks):
53
  chunk_embeddings = model.encode(text_chunks, convert_to_tensor=True)
54
  return chunk_embeddings
55
 
56
+
57
+
58
  chunk_embeddings = create_embeddings(cleaned_chunks)
59
 
60
+
61
+
62
  # Get top chunks
63
  def get_top_chunks(query, chunk_embeddings, text_chunks):
64
  query_embedding = model.encode(query, convert_to_tensor=True)
 
69
  top_chunks = [text_chunks[i] for i in top_indices]
70
  return top_chunks
71
 
72
+
73
+
74
  # Inference client
75
  client = InferenceClient("Qwen/Qwen2.5-72B-Instruct")
76
 
77
+
78
+
79
  def respond(message, history):
80
  top_results = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
81
  str_top_results = '\n'.join(top_results)
 
85
  if history:
86
  messages.extend(history)
87
  messages.append({'role': 'user', 'content': message})
88
+
89
+
90
+
91
  response = client.chat_completion(
92
  messages,
93
  max_tokens=1000,
 
95
  )
96
  return response['choices'][0]['message']['content'].strip()
97
 
98
+
99
+
100
  def display_image():
101
  return "KWKbanner.png"
102
 
103
+
104
+
105
  # Explore Page Info
106
  def show_info(topic):
107
  responses = {
 
113
  }
114
  return responses.get(topic, "Select a category to see the corresponding careers.")
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+
118
+ # Resources Page Info - UPDATED
119
  def resource_block(career):
120
+ resources = {
121
+ "AI/Machine Learning Engineer": {
122
+ "links": [
123
+ ("Neural Networks – DeepLearning.AI", "https://www.deeplearning.ai"),
124
+ ("Build ML Models – Fast.ai", "https://www.fast.ai"),
125
+ ("Machine Learning – Stanford CS229", "https://cs229.stanford.edu/")
126
+ ],
127
+ "college": {
128
+ "major": "Computer Science, Data Science",
129
+ "classes": [
130
+ "CS50: Introduction to Computer Science (Harvard)",
131
+ "Linear Algebra",
132
+ "Probability and Statistics",
133
+ "Machine Learning (Stanford CS229)",
134
+ "Algorithms"
135
+ ]
136
+ }
137
+ },
138
+ "Data Scientist": {
139
+ "links": [
140
+ ("Python & Pandas – Kaggle Learn", "https://www.kaggle.com/learn"),
141
+ ("R Programming – Harvard Data Science", "https://online-learning.harvard.edu/series/data-science"),
142
+ ("Project Practice – DataCamp", "https://www.datacamp.com")
143
+ ],
144
+ "college": {
145
+ "major": "Data Science, Statistics, Computer Science",
146
+ "classes": [
147
+ "Introduction to Data Science",
148
+ "Statistics and Probability",
149
+ "Data Mining",
150
+ "Machine Learning",
151
+ "Database Systems"
152
+ ]
153
+ }
154
+ },
155
+ "Cloud Solutions Architect": {
156
+ "links": [
157
+ ("AWS Skills – AWS Training", "https://aws.amazon.com/training/"),
158
+ ("Azure Certifications – Microsoft Learn", "https://learn.microsoft.com/en-us/certifications/"),
159
+ ("Google Cloud Labs – Google Cloud Boost", "https://cloudskillsboost.google/")
160
+ ],
161
+ "college": {
162
+ "major": "Computer Science, Information Technology",
163
+ "classes": [
164
+ "Cloud Computing Fundamentals",
165
+ "Computer Networks",
166
+ "Systems Design",
167
+ "Information Security",
168
+ "Operating Systems"
169
+ ]
170
+ }
171
+ },
172
+ "Cybersecurity Analyst": {
173
+ "links": [
174
+ ("Network Security – Cybrary", "https://www.cybrary.it"),
175
+ ("Threat Intelligence – MITRE ATT&CK", "https://attack.mitre.org/"),
176
+ ("Ethical Hacking – TryHackMe", "https://tryhackme.com")
177
+ ],
178
+ "college": {
179
+ "major": "Cybersecurity, Computer Science, Information Security",
180
+ "classes": [
181
+ "Network Security",
182
+ "Cryptography",
183
+ "Ethical Hacking",
184
+ "Operating Systems",
185
+ "Incident Response"
186
+ ]
187
+ }
188
+ },
189
+ "Statistician": {
190
+ "links": [
191
+ ("Intro to Statistics – Coursera (R)", "https://www.coursera.org/specializations/statistics"),
192
+ ("Probability – Khan Academy", "https://www.khanacademy.org/math/statistics-probability"),
193
+ ("Statistical Tools – OpenIntro", "https://www.openintro.org/book/os/")
194
+ ],
195
+ "college": {
196
+ "major": "Statistics, Mathematics",
197
+ "classes": [
198
+ "Probability Theory",
199
+ "Statistical Inference",
200
+ "Regression Analysis",
201
+ "Experimental Design",
202
+ "Data Analysis with R"
203
+ ]
204
+ }
205
+ },
206
+ "Biomedical Engineer": {
207
+ "links": [
208
+ ("Biomedical Research – JHU BME", "https://www.bme.jhu.edu/"),
209
+ ("Medical Devices – edX Courses", "https://www.edx.org/learn/biomedical-engineering"),
210
+ ("Clinical Trials – NIH", "https://www.nih.gov/")
211
+ ],
212
+ "college": {
213
+ "major": "Biomedical Engineering, Bioengineering",
214
+ "classes": [
215
+ "Biomaterials",
216
+ "Human Physiology",
217
+ "Medical Instrumentation",
218
+ "Biomechanics",
219
+ "Tissue Engineering"
220
+ ]
221
+ }
222
+ },
223
+ "Mechanical Engineer": {
224
+ "links": [
225
+ ("CAD Design – Coursera", "https://www.coursera.org/learn/cad-design"),
226
+ ("Thermodynamics – MIT OpenCourseWare", "https://ocw.mit.edu/courses/thermodynamics"),
227
+ ("Materials Science Basics – edX", "https://www.edx.org/course/material-science")
228
+ ],
229
+ "college": {
230
+ "major": "Mechanical Engineering",
231
+ "classes": [
232
+ "Thermodynamics",
233
+ "Fluid Mechanics",
234
+ "Materials Science",
235
+ "Computer-Aided Design (CAD)",
236
+ "Dynamics and Control"
237
+ ]
238
+ }
239
+ },
240
+ "Environmental Scientist": {
241
+ "links": [
242
+ ("Environmental Science – Khan Academy", "https://www.khanacademy.org/science/biology/ecology"),
243
+ ("GIS Basics – Esri Training", "https://www.esri.com/training/catalog/57630435851d31e02a43f1c5/gis-basics/"),
244
+ ("Data Analysis – Coursera", "https://www.coursera.org/learn/data-analysis")
245
+ ],
246
+ "college": {
247
+ "major": "Environmental Science, Ecology",
248
+ "classes": [
249
+ "Ecology",
250
+ "Environmental Chemistry",
251
+ "Geographic Information Systems (GIS)",
252
+ "Data Analysis",
253
+ "Environmental Policy"
254
+ ]
255
+ }
256
+ },
257
+ "Operations Research Analyst": {
258
+ "links": [
259
+ ("Linear Programming – Khan Academy", "https://www.khanacademy.org/computing/computer-science/algorithms"),
260
+ ("Optimization – MIT OpenCourseWare", "https://ocw.mit.edu/courses/optimization-methods"),
261
+ ("Statistics – Harvard Online", "https://online-learning.harvard.edu/course/statistics-and-r")
262
+ ],
263
+ "college": {
264
+ "major": "Operations Research, Applied Mathematics",
265
+ "classes": [
266
+ "Optimization Theory",
267
+ "Linear Programming",
268
+ "Probability",
269
+ "Statistics",
270
+ "Simulation Modeling"
271
+ ]
272
+ }
273
+ },
274
+ "Mathematician": {
275
+ "links": [
276
+ ("Abstract Algebra – MIT OpenCourseWare", "https://ocw.mit.edu/courses/abstract-algebra"),
277
+ ("Calculus – Khan Academy", "https://www.khanacademy.org/math/calculus-1"),
278
+ ("Proof Techniques – Coursera", "https://www.coursera.org/learn/proofs")
279
+ ],
280
+ "college": {
281
+ "major": "Mathematics",
282
+ "classes": [
283
+ "Algebra",
284
+ "Calculus",
285
+ "Real Analysis",
286
+ "Abstract Algebra",
287
+ "Proof Writing"
288
+ ]
289
+ }
290
+ },
291
+ "Chemical Engineer": {
292
+ "links": [
293
+ ("Chemical Process Principles – MIT OCW", "https://ocw.mit.edu/courses/chemical-engineering"),
294
+ ("Organic Chemistry – Khan Academy", "https://www.khanacademy.org/science/organic-chemistry"),
295
+ ("Thermodynamics – Coursera", "https://www.coursera.org/learn/thermodynamics")
296
+ ],
297
+ "college": {
298
+ "major": "Chemical Engineering",
299
+ "classes": [
300
+ "Organic Chemistry",
301
+ "Thermodynamics",
302
+ "Process Design",
303
+ "Fluid Mechanics",
304
+ "Chemical Reaction Engineering"
305
+ ]
306
+ }
307
+ },
308
+ "Civil Engineer": {
309
+ "links": [
310
+ ("Structural Analysis – Coursera", "https://www.coursera.org/learn/structural-analysis"),
311
+ ("Construction Management – edX", "https://www.edx.org/course/construction-management"),
312
+ ("AutoCAD – LinkedIn Learning", "https://www.linkedin.com/learning/topics/autocad")
313
+ ],
314
+ "college": {
315
+ "major": "Civil Engineering",
316
+ "classes": [
317
+ "Structural Analysis",
318
+ "Construction Materials",
319
+ "Soil Mechanics",
320
+ "AutoCAD",
321
+ "Hydraulics"
322
+ ]
323
+ }
324
+ },
325
+ "Electrical Engineer": {
326
+ "links": [
327
+ ("Circuits and Electronics – MIT OCW", "https://ocw.mit.edu/courses/electrical-engineering-and-computer-science"),
328
+ ("Signals and Systems – Coursera", "https://www.coursera.org/learn/signals-systems"),
329
+ ("Electromagnetics – Khan Academy", "https://www.khanacademy.org/science/electrical-engineering")
330
+ ],
331
+ "college": {
332
+ "major": "Electrical Engineering",
333
+ "classes": [
334
+ "Circuits",
335
+ "Signals and Systems",
336
+ "Electromagnetics",
337
+ "Control Systems",
338
+ "Digital Logic Design"
339
+ ]
340
+ }
341
+ },
342
+ "Software Developer": {
343
+ "links": [
344
+ ("CS50 – Harvard", "https://cs50.harvard.edu"),
345
+ ("Learn to Code – Codecademy", "https://www.codecademy.com/catalog/subject/all"),
346
+ ("Algorithms – Coursera", "https://www.coursera.org/learn/algorithms-part1")
347
+ ],
348
+ "college": {
349
+ "major": "Computer Science, Software Engineering",
350
+ "classes": [
351
+ "Introduction to Computer Science (CS50)",
352
+ "Data Structures and Algorithms",
353
+ "Operating Systems",
354
+ "Software Engineering",
355
+ "Databases"
356
+ ]
357
+ }
358
+ },
359
+ "Pharmacist": {
360
+ "links": [
361
+ ("Pharmacology Basics – Coursera", "https://www.coursera.org/learn/pharmacology"),
362
+ ("Drug Development – edX", "https://www.edx.org/course/drug-development"),
363
+ ("Pharmacy Practice – FutureLearn", "https://www.futurelearn.com/courses/pharmacy-practice")
364
+ ],
365
+ "college": {
366
+ "major": "Pharmacy, Pharmaceutical Sciences",
367
+ "classes": [
368
+ "Pharmacology",
369
+ "Medicinal Chemistry",
370
+ "Pharmaceutical Calculations",
371
+ "Pharmaceutics",
372
+ "Clinical Pharmacy"
373
+ ]
374
+ }
375
+ },
376
+ "Physicist": {
377
+ "links": [
378
+ ("Classical Mechanics – MIT OCW", "https://ocw.mit.edu/courses/physics"),
379
+ ("Quantum Mechanics – edX", "https://www.edx.org/course/quantum-mechanics"),
380
+ ("Thermodynamics – Khan Academy", "https://www.khanacademy.org/science/physics/thermodynamics")
381
+ ],
382
+ "college": {
383
+ "major": "Physics",
384
+ "classes": [
385
+ "Classical Mechanics",
386
+ "Quantum Mechanics",
387
+ "Thermodynamics",
388
+ "Electromagnetism",
389
+ "Mathematical Methods for Physicists"
390
+ ]
391
+ }
392
+ },
393
+ "Astronomer": {
394
+ "links": [
395
+ ("Introduction to Astronomy – Coursera", "https://www.coursera.org/learn/astronomy"),
396
+ ("Astrophysics – edX", "https://www.edx.org/course/astrophysics"),
397
+ ("Cosmology – Khan Academy", "https://www.khanacademy.org/science/cosmology-and-astronomy")
398
+ ],
399
+ "college": {
400
+ "major": "Astronomy, Astrophysics, Physics",
401
+ "classes": [
402
+ "Introduction to Astronomy",
403
+ "Astrophysics",
404
+ "Cosmology",
405
+ "Observational Astronomy",
406
+ "Data Analysis in Astronomy"
407
+ ]
408
+ }
409
+ },
410
+ "Geologist": {
411
+ "links": [
412
+ ("Physical Geology – OpenStax", "https://openstax.org/details/books/physical-geology"),
413
+ ("Geochemistry – Coursera", "https://www.coursera.org/learn/geochemistry"),
414
+ ("GIS Mapping – Esri Training", "https://www.esri.com/training/catalog/57630435851d31e02a43f1c5/gis-basics/")
415
+ ],
416
+ "college": {
417
+ "major": "Geology, Earth Science",
418
+ "classes": [
419
+ "Physical Geology",
420
+ "Mineralogy and Petrology",
421
+ "Geochemistry",
422
+ "GIS and Remote Sensing",
423
+ "Structural Geology"
424
+ ]
425
+ }
426
+ },
427
+ "Biochemist": {
428
+ "links": [
429
+ ("Biochemistry – MIT OCW", "https://ocw.mit.edu/courses/biochemistry"),
430
+ ("Molecular Biology – Coursera", "https://www.coursera.org/learn/molecular-biology"),
431
+ ("Enzymology – Khan Academy", "https://www.khanacademy.org/science/biology")
432
+ ],
433
+ "college": {
434
+ "major": "Biochemistry, Molecular Biology",
435
+ "classes": [
436
+ "General Biochemistry",
437
+ "Molecular Biology",
438
+ "Enzymology",
439
+ "Cell Biology",
440
+ "Genetics"
441
+ ]
442
+ }
443
+ }
444
+ }
445
+
446
+
447
+
448
+ content = resources.get(career)
449
  if not content:
450
  return "Select a career to see resources.", ""
451
 
 
 
 
 
452
 
 
 
 
 
 
 
453
 
454
+ link_html = "<ul>"
455
+ for label, url in content["links"]:
456
+ link_html += f'<li><strong>{label}</strong>: <a href="{url}" target="_blank">{url}</a></li>'
457
+ link_html += "</ul>"
458
+
459
+
460
+
461
+ college_html = ""
462
+ if "college" in content:
463
+ college = content["college"]
464
+ college_html += "<p><strong>College & Classes</strong></p><ul>"
465
+ college_html += f"<li><em>Common Major(s):</em> {college['major']}</li>"
466
+ classes_list = college.get("classes", [])
467
+ if isinstance(classes_list, list):
468
+ classes_html = ", ".join(classes_list)
469
+ else:
470
+ classes_html = str(classes_list)
471
+ college_html += f"<li><em>Helpful College Classes:</em> {classes_html}</li>"
472
+ college_html += "</ul>"
473
+
474
+
475
+
476
+ # No video iframe, just empty string for second output
477
+ return link_html + college_html, ""
478
+
479
+
480
 
481
  # UI Layout
482
  with gr.Blocks(theme=theme, css=custom_css) as chatbot:
483
  gr.Image(display_image)
484
 
485
+
486
+
487
  with gr.Tab("ChatBot"):
488
  gr.ChatInterface(
489
  respond,
 
493
  description='This tool provides information on STEM Careers. All information is sourced from [census.gov](https://www.census.gov/).'
494
  )
495
 
496
+
497
+
498
+
499
+
500
+
501
+ with gr.Tab("Explore Now"): # ✅ Changed title
502
  gr.Markdown("### Explore STEM Career Categories")
503
  dropdown_explore = gr.Dropdown(
504
  choices=[
 
511
  label="Choose a Category"
512
  )
513
  output_explore = gr.Markdown()
514
+
515
+
516
+
517
  dropdown_explore.change(fn=show_info, inputs=dropdown_explore, outputs=output_explore)
518
 
519
+
520
+
521
+
522
+
523
+
524
  with gr.Tab("Resources"):
525
  gr.Markdown("### Career-Specific Educational Resources")
526
  dropdown_resources = gr.Dropdown(
527
+ choices=[
528
+ "AI/Machine Learning Engineer",
529
+ "Data Scientist",
530
+ "Cloud Solutions Architect",
531
+ "Cybersecurity Analyst",
532
+ "Statistician",
533
+ "Biomedical Engineer",
534
+ "Mechanical Engineer",
535
+ "Environmental Scientist",
536
+ "Operations Research Analyst",
537
+ "Mathematician",
538
+ "Chemical Engineer",
539
+ "Civil Engineer",
540
+ "Electrical Engineer",
541
+ "Software Developer",
542
+ "Pharmacist",
543
+ "Physicist",
544
+ "Astronomer",
545
+ "Geologist",
546
+ "Biochemist"
547
+ ],
548
  label="Choose a Career"
549
  )
550
  output_links = gr.HTML()
551
  output_video = gr.HTML()
552
+ dropdown_resources.change(
553
+ fn=resource_block,
554
+ inputs=dropdown_resources,
555
+ outputs=[output_links, output_video]
556
+ )
557
+
558
+
559
 
560
  chatbot.launch()
561
+
562
+