mahika123 commited on
Commit
abbbad3
Β·
verified Β·
1 Parent(s): d847ba5
Files changed (1) hide show
  1. app.py +82 -46
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from sentence_transformers import SentenceTransformer
4
- import torch
5
 
6
  # Theme
7
  theme = gr.themes.Soft(
@@ -12,10 +12,10 @@ theme = gr.themes.Soft(
12
 
13
  custom_css = """
14
  :root {
15
- --background-fill-primary: #FFB6C2 !important;
16
  }
17
  .dark {
18
- --background-fill-primary: #FFB6C1 !important;
19
  }
20
  """
21
 
@@ -63,7 +63,6 @@ def respond(message, history):
63
  if history:
64
  messages.extend(history)
65
  messages.append({'role': 'user', 'content': message})
66
-
67
  response = client.chat_completion(
68
  messages,
69
  max_tokens=1000,
@@ -79,31 +78,93 @@ def show_info(topic):
79
  responses = {
80
  "Highest Paying STEM Jobs": "1. AI/Machine Learning Engineer – $171,774\n2. Cloud Solutions Architect – $150,241\n3. Quantitative Analyst (Quant) – $139,949\n4. Data Scientist – $128,115\n5. Actuary – $128,147",
81
  "Most Flexible STEM Jobs": "1. Software Developer\n2. Cloud Solutions Architect\n3. Data Scientist\n4. Cybersecurity Analyst\n5. Statistician",
82
- "Most Creative STEM Jobs": "1. Software Developer\n2. AI/Machine Learning Engineer\n3. Biomedical Engineer\n4. Mechanical Engineer\n5. Biochemist",
83
- "Fastest Growing STEM Jobs": "1. AI/Machine Learning Engineer\n2. Cybersecurity Analyst\n3. Data Scientist\n4. Software Developer\n5. Cloud Solutions Architect",
84
  "Low-Stress STEM Jobs": "1. Statistician\n2. Mathematician\n3. Operations Research Analyst\n4. Environmental Scientist\n5. Biochemist"
85
  }
86
  return responses.get(topic, "Select a category to see the corresponding careers.")
87
 
88
- # Resources Page Info - UPDATED
89
  def resource_block(career):
90
  yt_videos = {
91
- "AI/Machine Learning Engineer": "https://www.youtube.com/embed/ukzFI9rgwfU",
92
- "Data Scientist": "https://www.youtube.com/embed/xC-c7E5PK0Y",
93
- "Cloud Solutions Architect": "https://www.youtube.com/embed/l1EssrLxt7E"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
95
 
96
- # Reuse existing function to get resources
97
- from app import resource_block as base_resource_block
98
- text_html, _ = base_resource_block(career)
99
 
100
- video_url = yt_videos.get(career)
101
- if video_url:
102
- video_html = f'<iframe width="100%" height="315" src="{video_url}" frameborder="0" allowfullscreen></iframe>'
103
- else:
104
- video_html = ""
105
 
106
- return text_html, video_html
 
 
 
 
 
 
 
 
 
107
 
108
  # UI Layout
109
  with gr.Blocks(theme=theme, css=custom_css) as chatbot:
@@ -139,37 +200,12 @@ with gr.Blocks(theme=theme, css=custom_css) as chatbot:
139
  choices=[
140
  "AI/Machine Learning Engineer",
141
  "Data Scientist",
142
- "Cloud Solutions Architect",
143
- "Cybersecurity Analyst",
144
- "Statistician",
145
- "Biomedical Engineer",
146
- "Mechanical Engineer",
147
- "Environmental Scientist",
148
- "Operations Research Analyst",
149
- "Mathematician",
150
- "Chemical Engineer",
151
- "Civil Engineer",
152
- "Electrical Engineer",
153
- "Software Developer",
154
- "Pharmacist",
155
- "Physicist",
156
- "Astronomer",
157
- "Geologist",
158
- "Biochemist"
159
  ],
160
  label="Choose a Career"
161
  )
162
  output_links = gr.HTML()
163
  output_video = gr.HTML()
164
- dropdown_resources.change(
165
- fn=resource_block,
166
- inputs=dropdown_resources,
167
- outputs=[output_links, output_video]
168
- )
169
 
170
  chatbot.launch()
171
-
172
-
173
-
174
-
175
-
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from sentence_transformers import SentenceTransformer
4
+ import torch
5
 
6
  # Theme
7
  theme = gr.themes.Soft(
 
12
 
13
  custom_css = """
14
  :root {
15
+ --background-fill-primary: #FFB6C2 !important;
16
  }
17
  .dark {
18
+ --background-fill-primary: #FFB6C1 !important;
19
  }
20
  """
21
 
 
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,
 
78
  responses = {
79
  "Highest Paying STEM Jobs": "1. AI/Machine Learning Engineer – $171,774\n2. Cloud Solutions Architect – $150,241\n3. Quantitative Analyst (Quant) – $139,949\n4. Data Scientist – $128,115\n5. Actuary – $128,147",
80
  "Most Flexible STEM Jobs": "1. Software Developer\n2. Cloud Solutions Architect\n3. Data Scientist\n4. Cybersecurity Analyst\n5. Statistician",
81
+ "Most Creative STEM Jobs": "1. Software Developer\n2. AI/Machine Learning Engineer\n3. Biomedical Engineer\n4. Mechanical Engineer\n5. Biochemist",
82
+ "Fastest Growing STEM Jobs": "1. AI/Machine Learning Engineer\n2. Cybersecurity Analyst\n3. Data Scientist\n4. Software Developer\n5. Cloud Solutions Architect",
83
  "Low-Stress STEM Jobs": "1. Statistician\n2. Mathematician\n3. Operations Research Analyst\n4. Environmental Scientist\n5. Biochemist"
84
  }
85
  return responses.get(topic, "Select a category to see the corresponding careers.")
86
 
87
+ # Resources Page
88
  def resource_block(career):
89
  yt_videos = {
90
+ "AI/Machine Learning Engineer": '<iframe width="100%" height="315" src="https://www.youtube.com/embed/ukzFI9rgwfU" title="AI Career Advice" frameborder="0" allowfullscreen></iframe>',
91
+ "Data Scientist": '<iframe width="100%" height="315" src="https://www.youtube.com/embed/xC-c7E5PK0Y" title="Day in the Life of Data Scientist" frameborder="0" allowfullscreen></iframe>',
92
+ "Cloud Solutions Architect": '<iframe width="100%" height="315" src="https://www.youtube.com/embed/COgFYt6GxC4" title="Become a Cloud Architect" frameborder="0" allowfullscreen></iframe>'
93
+ }
94
+
95
+ resources = {
96
+ "AI/Machine Learning Engineer": {
97
+ "links": [
98
+ ("Neural Networks – DeepLearning.AI", "https://www.deeplearning.ai"),
99
+ ("Build ML Models – Fast.ai", "https://www.fast.ai"),
100
+ ("Machine Learning – Stanford CS229", "https://cs229.stanford.edu/")
101
+ ],
102
+ "college": {
103
+ "major": "Computer Science, Data Science",
104
+ "classes": [
105
+ "CS50: Introduction to Computer Science (Harvard)",
106
+ "Linear Algebra",
107
+ "Probability and Statistics",
108
+ "Machine Learning (Stanford CS229)",
109
+ "Algorithms"
110
+ ]
111
+ }
112
+ },
113
+ "Data Scientist": {
114
+ "links": [
115
+ ("Python & Pandas – Kaggle Learn", "https://www.kaggle.com/learn"),
116
+ ("R Programming – Harvard Data Science", "https://online-learning.harvard.edu/series/data-science"),
117
+ ("Project Practice – DataCamp", "https://www.datacamp.com")
118
+ ],
119
+ "college": {
120
+ "major": "Data Science, Statistics, Computer Science",
121
+ "classes": [
122
+ "Introduction to Data Science",
123
+ "Statistics and Probability",
124
+ "Data Mining",
125
+ "Machine Learning",
126
+ "Database Systems"
127
+ ]
128
+ }
129
+ },
130
+ "Cloud Solutions Architect": {
131
+ "links": [
132
+ ("AWS Skills – AWS Training", "https://aws.amazon.com/training/"),
133
+ ("Azure Certifications – Microsoft Learn", "https://learn.microsoft.com/en-us/certifications/"),
134
+ ("Google Cloud Labs – Google Cloud Boost", "https://cloudskillsboost.google/")
135
+ ],
136
+ "college": {
137
+ "major": "Computer Science, Information Technology",
138
+ "classes": [
139
+ "Cloud Computing Fundamentals",
140
+ "Computer Networks",
141
+ "Systems Design",
142
+ "Information Security",
143
+ "Operating Systems"
144
+ ]
145
+ }
146
+ }
147
  }
148
 
149
+ content = resources.get(career)
150
+ if not content:
151
+ return "Select a career to see resources.", ""
152
 
153
+ link_html = "<h4>🧠 Skills & Learning Resources</h4><ul>"
154
+ for label, url in content["links"]:
155
+ link_html += f"<li><strong>{label}</strong>: <a href='{url}' target='_blank'>{url}</a></li>"
156
+ link_html += "</ul><br>"
 
157
 
158
+ college_html = ""
159
+ if "college" in content:
160
+ college = content["college"]
161
+ college_html += "<h4>πŸŽ“ College & Classes</h4><ul>"
162
+ college_html += f"<li><strong>Majors:</strong> {college['major']}</li>"
163
+ college_html += f"<li><strong>Helpful Classes:</strong> {', '.join(college['classes'])}</li>"
164
+ college_html += "</ul><br>"
165
+
166
+ video_embed = yt_videos.get(career, "")
167
+ return link_html + college_html, video_embed
168
 
169
  # UI Layout
170
  with gr.Blocks(theme=theme, css=custom_css) as chatbot:
 
200
  choices=[
201
  "AI/Machine Learning Engineer",
202
  "Data Scientist",
203
+ "Cloud Solutions Architect"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  ],
205
  label="Choose a Career"
206
  )
207
  output_links = gr.HTML()
208
  output_video = gr.HTML()
209
+ dropdown_resources.change(fn=resource_block, inputs=dropdown_resources, outputs=[output_links, output_video])
 
 
 
 
210
 
211
  chatbot.launch()