Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
|
|
|
|
|
2 |
# import gradio as gr
|
3 |
# import pandas as pd
|
4 |
# import numpy as np
|
@@ -6,16 +8,21 @@
|
|
6 |
# import sklearn
|
7 |
# from datasets import load_dataset
|
8 |
|
|
|
9 |
# data = pd.read_csv("mldata.csv")
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
# #
|
13 |
-
# # pickleFile = open('rfweights (1).pkl','rb')
|
14 |
-
# pickelFile=open('dtreeweights.pkl','rb')
|
15 |
-
# rfmodel = pickle.load(pickelFile)
|
16 |
-
|
17 |
-
# #Obtain the categorical/nominal data because it is not coded according (but based on the first occurence, first come first assign number)
|
18 |
-
# #Therefore, need to read from the file to obtain the number.
|
19 |
# categorical_cols = data[[
|
20 |
# 'certifications',
|
21 |
# 'workshops',
|
@@ -23,63 +30,35 @@
|
|
23 |
# 'interested career area ',
|
24 |
# 'Type of company want to settle in?',
|
25 |
# 'Interested Type of Books'
|
26 |
-
#
|
27 |
-
|
|
|
28 |
# for i in categorical_cols:
|
29 |
# data[i] = data[i].astype('category')
|
30 |
# data[i] = data[i].cat.codes
|
31 |
|
32 |
-
# #
|
33 |
-
#
|
34 |
-
#
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
#
|
39 |
-
#
|
40 |
-
#
|
41 |
-
|
42 |
-
#
|
43 |
-
#
|
44 |
-
|
45 |
-
#
|
46 |
-
|
47 |
-
#
|
48 |
-
#
|
49 |
-
# career_interest_code = list(data['interested career area '].unique())
|
50 |
-
# career_interest_references = dict(zip(career_interest_name, career_interest_code))
|
51 |
-
|
52 |
-
# #embedding for company_intends
|
53 |
-
# company_intends_name = list(categorical_cols['Type of company want to settle in?'].unique())
|
54 |
-
# company_intends_code = list(data['Type of company want to settle in?'].unique())
|
55 |
-
# company_intends_references = dict(zip(company_intends_name, company_intends_code))
|
56 |
-
|
57 |
-
# #embedding for book_interests
|
58 |
-
# book_interest_name = list(categorical_cols['Interested Type of Books'].unique())
|
59 |
-
# book_interest_code = list(data['Interested Type of Books'].unique())
|
60 |
-
# book_interest_references = dict(zip(book_interest_name, book_interest_code))
|
61 |
-
|
62 |
-
|
63 |
-
# def greet(name):
|
64 |
-
# return f"Hello, {name}!"
|
65 |
-
|
66 |
-
# '''#dummy encode
|
67 |
-
# def dummy_encode(df):
|
68 |
-
# if input == "Management":
|
69 |
-
# return [1, 0]
|
70 |
-
# elif input == "Technical":
|
71 |
-
# return [0, 1]
|
72 |
-
# elif input == "smart worker":
|
73 |
-
# return [1, 0]
|
74 |
-
# elif input == "hard worker":
|
75 |
-
# return [0, 1]
|
76 |
-
# else:
|
77 |
-
# return "Invalid choice"'''
|
78 |
-
|
79 |
-
# def rfprediction(name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
80 |
-
# self_learning, extra_course, certificate_code, worskhop_code, read_writing_skill, memory_capability
|
81 |
-
# ,subject_interest, career_interest, company_intend, senior_elder_advise, book_interest, introvert_extro,
|
82 |
# team_player, management_technical, smart_hardworker):
|
|
|
|
|
|
|
|
|
83 |
# df = pd.DataFrame.from_dict(
|
84 |
# {
|
85 |
# "logical_thinking": [logical_thinking],
|
@@ -108,18 +87,20 @@
|
|
108 |
# }
|
109 |
# )
|
110 |
|
111 |
-
# #
|
112 |
-
# df = df.replace({
|
113 |
-
#
|
114 |
-
#
|
115 |
-
#
|
116 |
-
#
|
117 |
-
#
|
|
|
|
|
118 |
|
119 |
-
# #
|
120 |
-
# #first we convert into list from df
|
121 |
# userdata_list = df.values.tolist()
|
122 |
-
|
|
|
123 |
# if(df["management_technical"].values == "Management"):
|
124 |
# userdata_list[0].extend([1])
|
125 |
# userdata_list[0].extend([0])
|
@@ -128,8 +109,10 @@
|
|
128 |
# userdata_list[0].extend([0])
|
129 |
# userdata_list[0].extend([1])
|
130 |
# userdata_list[0].remove('Technical')
|
131 |
-
# else:
|
|
|
132 |
|
|
|
133 |
# if(df["smart_hardworker"].values == "smart worker"):
|
134 |
# userdata_list[0].extend([1])
|
135 |
# userdata_list[0].extend([0])
|
@@ -138,30 +121,33 @@
|
|
138 |
# userdata_list[0].extend([0])
|
139 |
# userdata_list[0].extend([1])
|
140 |
# userdata_list[0].remove('hard worker')
|
141 |
-
# else:
|
|
|
142 |
|
143 |
-
#
|
144 |
# prediction_result_all = rfmodel.predict_proba(userdata_list)
|
145 |
-
|
146 |
-
# #
|
147 |
-
# result_list = {
|
148 |
-
#
|
149 |
-
#
|
150 |
-
#
|
151 |
-
#
|
152 |
-
#
|
153 |
-
#
|
154 |
-
#
|
155 |
-
#
|
156 |
-
#
|
157 |
-
#
|
158 |
-
#
|
159 |
-
#
|
|
|
160 |
# return result_list
|
161 |
|
|
|
162 |
# cert_list = ["app development", "distro making", "full stack", "hadoop", "information security", "machine learning", "python", "r programming", "shell programming"]
|
163 |
# workshop_list = ["cloud computing", "data science", "database security", "game development", "hacking", "system designing", "testing", "web technologies"]
|
164 |
-
# skill = ["excellent", "medium", "poor"]
|
165 |
# subject_list = ["cloud computing", "Computer Architecture", "data engineering", "hacking", "IOT", "Management", "networks", "parallel computing", "programming", "Software Engineering"]
|
166 |
# career_list = ["Business process analyst", "cloud computing", "developer", "security", "system developer", "testing"]
|
167 |
# company_list = ["BPA", "Cloud Services", "Finance", "Product based", "product development", "SAaS services", "Sales and Marketing", "Service Based", "Testing and Maintainance Services", "Web Services"]
|
@@ -169,44 +155,47 @@
|
|
169 |
# Choice_list = ["Management", "Technical"]
|
170 |
# worker_list = ["hard worker", "smart worker"]
|
171 |
|
172 |
-
#
|
173 |
-
#
|
174 |
-
#
|
175 |
-
#
|
176 |
-
#
|
177 |
-
#
|
178 |
-
#
|
179 |
-
#
|
180 |
-
#
|
181 |
-
#
|
182 |
-
#
|
183 |
-
#
|
184 |
-
#
|
185 |
-
#
|
186 |
-
#
|
187 |
-
#
|
188 |
-
#
|
189 |
-
#
|
190 |
-
#
|
191 |
-
#
|
192 |
-
#
|
193 |
-
#
|
194 |
-
#
|
195 |
-
#
|
196 |
-
#
|
197 |
-
#
|
198 |
-
|
199 |
-
|
200 |
-
#
|
|
|
|
|
|
|
201 |
# if __name__ == "__main__":
|
202 |
# demo.launch(share=True)
|
203 |
|
204 |
-
|
205 |
import gradio as gr
|
206 |
import pandas as pd
|
207 |
import numpy as np
|
208 |
import pickle
|
209 |
import sklearn
|
|
|
210 |
from datasets import load_dataset
|
211 |
|
212 |
# Read the data
|
@@ -223,7 +212,7 @@ def load_model(model_choice):
|
|
223 |
else:
|
224 |
raise ValueError("Invalid model selection")
|
225 |
|
226 |
-
# Prepare categorical data
|
227 |
categorical_cols = data[[
|
228 |
'certifications',
|
229 |
'workshops',
|
@@ -238,7 +227,7 @@ for i in categorical_cols:
|
|
238 |
data[i] = data[i].astype('category')
|
239 |
data[i] = data[i].cat.codes
|
240 |
|
241 |
-
# Create reference dictionaries for embeddings
|
242 |
def create_embedding_dict(column):
|
243 |
unique_names = list(categorical_cols[column].unique())
|
244 |
unique_codes = list(data[column].unique())
|
@@ -251,7 +240,7 @@ career_interest_references = create_embedding_dict('interested career area ')
|
|
251 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
252 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
253 |
|
254 |
-
# Prediction function (modified to
|
255 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
256 |
self_learning, extra_course, certificate_code, worskhop_code, read_writing_skill, memory_capability,
|
257 |
subject_interest, career_interest, company_intend, senior_elder_advise, book_interest, introvert_extro,
|
@@ -259,7 +248,7 @@ def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_
|
|
259 |
# Load the selected model
|
260 |
rfmodel = load_model(model_choice)
|
261 |
|
262 |
-
# Create DataFrame
|
263 |
df = pd.DataFrame.from_dict(
|
264 |
{
|
265 |
"logical_thinking": [logical_thinking],
|
@@ -298,7 +287,7 @@ def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_
|
|
298 |
"book_interest": book_interest_references
|
299 |
})
|
300 |
|
301 |
-
# Dummy encoding
|
302 |
userdata_list = df.values.tolist()
|
303 |
|
304 |
# Management-Technical dummy encoding
|
@@ -343,9 +332,35 @@ def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_
|
|
343 |
"UX Designer": float(prediction_result_all[0][10]),
|
344 |
"Web Developer": float(prediction_result_all[0][11]),
|
345 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
return result_list
|
347 |
|
348 |
-
# Lists for dropdown menus
|
349 |
cert_list = ["app development", "distro making", "full stack", "hadoop", "information security", "machine learning", "python", "r programming", "shell programming"]
|
350 |
workshop_list = ["cloud computing", "data science", "database security", "game development", "hacking", "system designing", "testing", "web technologies"]
|
351 |
skill = ["excellent", "medium", "poor"]
|
@@ -356,7 +371,7 @@ book_list = ["Action and Adventure", "Anthology", "Art", "Autobiographies", "Bio
|
|
356 |
Choice_list = ["Management", "Technical"]
|
357 |
worker_list = ["hard worker", "smart worker"]
|
358 |
|
359 |
-
# Create Gradio interface
|
360 |
demo = gr.Interface(
|
361 |
fn=rfprediction,
|
362 |
inputs=[
|
|
|
1 |
|
2 |
+
|
3 |
+
|
4 |
# import gradio as gr
|
5 |
# import pandas as pd
|
6 |
# import numpy as np
|
|
|
8 |
# import sklearn
|
9 |
# from datasets import load_dataset
|
10 |
|
11 |
+
# # Read the data
|
12 |
# data = pd.read_csv("mldata.csv")
|
13 |
|
14 |
+
# # Function to load model based on selection
|
15 |
+
# def load_model(model_choice):
|
16 |
+
# if model_choice == "Random Forest":
|
17 |
+
# with open('rfweights (1).pkl', 'rb') as pickleFile:
|
18 |
+
# return pickle.load(pickleFile)
|
19 |
+
# elif model_choice == "Decision Tree":
|
20 |
+
# with open('dtreeweights.pkl', 'rb') as pickleFile:
|
21 |
+
# return pickle.load(pickleFile)
|
22 |
+
# else:
|
23 |
+
# raise ValueError("Invalid model selection")
|
24 |
|
25 |
+
# # Prepare categorical data (same as original code)
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# categorical_cols = data[[
|
27 |
# 'certifications',
|
28 |
# 'workshops',
|
|
|
30 |
# 'interested career area ',
|
31 |
# 'Type of company want to settle in?',
|
32 |
# 'Interested Type of Books'
|
33 |
+
# ]]
|
34 |
+
|
35 |
+
# # Assign category codes
|
36 |
# for i in categorical_cols:
|
37 |
# data[i] = data[i].astype('category')
|
38 |
# data[i] = data[i].cat.codes
|
39 |
|
40 |
+
# # Create reference dictionaries for embeddings (same as original code)
|
41 |
+
# def create_embedding_dict(column):
|
42 |
+
# unique_names = list(categorical_cols[column].unique())
|
43 |
+
# unique_codes = list(data[column].unique())
|
44 |
+
# return dict(zip(unique_names, unique_codes))
|
45 |
+
|
46 |
+
# certificates_references = create_embedding_dict('certifications')
|
47 |
+
# workshop_references = create_embedding_dict('workshops')
|
48 |
+
# subjects_interest_references = create_embedding_dict('Interested subjects')
|
49 |
+
# career_interest_references = create_embedding_dict('interested career area ')
|
50 |
+
# company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
51 |
+
# book_interest_references = create_embedding_dict('Interested Type of Books')
|
52 |
+
|
53 |
+
# # Prediction function (modified to accept model choice)
|
54 |
+
# def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
55 |
+
# self_learning, extra_course, certificate_code, worskhop_code, read_writing_skill, memory_capability,
|
56 |
+
# subject_interest, career_interest, company_intend, senior_elder_advise, book_interest, introvert_extro,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
# team_player, management_technical, smart_hardworker):
|
58 |
+
# # Load the selected model
|
59 |
+
# rfmodel = load_model(model_choice)
|
60 |
+
|
61 |
+
# # Create DataFrame (same as original code)
|
62 |
# df = pd.DataFrame.from_dict(
|
63 |
# {
|
64 |
# "logical_thinking": [logical_thinking],
|
|
|
87 |
# }
|
88 |
# )
|
89 |
|
90 |
+
# # Replace string values with numeric representations
|
91 |
+
# df = df.replace({
|
92 |
+
# "certificate": certificates_references,
|
93 |
+
# "workshop": workshop_references,
|
94 |
+
# "subject_interest": subjects_interest_references,
|
95 |
+
# "career_interest": career_interest_references,
|
96 |
+
# "company_intend": company_intends_references,
|
97 |
+
# "book_interest": book_interest_references
|
98 |
+
# })
|
99 |
|
100 |
+
# # Dummy encoding (same as original code)
|
|
|
101 |
# userdata_list = df.values.tolist()
|
102 |
+
|
103 |
+
# # Management-Technical dummy encoding
|
104 |
# if(df["management_technical"].values == "Management"):
|
105 |
# userdata_list[0].extend([1])
|
106 |
# userdata_list[0].extend([0])
|
|
|
109 |
# userdata_list[0].extend([0])
|
110 |
# userdata_list[0].extend([1])
|
111 |
# userdata_list[0].remove('Technical')
|
112 |
+
# else:
|
113 |
+
# return "Error in Management-Technical encoding"
|
114 |
|
115 |
+
# # Smart-Hard worker dummy encoding
|
116 |
# if(df["smart_hardworker"].values == "smart worker"):
|
117 |
# userdata_list[0].extend([1])
|
118 |
# userdata_list[0].extend([0])
|
|
|
121 |
# userdata_list[0].extend([0])
|
122 |
# userdata_list[0].extend([1])
|
123 |
# userdata_list[0].remove('hard worker')
|
124 |
+
# else:
|
125 |
+
# return "Error in Smart-Hard worker encoding"
|
126 |
|
127 |
+
# # Prediction
|
128 |
# prediction_result_all = rfmodel.predict_proba(userdata_list)
|
129 |
+
|
130 |
+
# # Create result dictionary
|
131 |
+
# result_list = {
|
132 |
+
# "Applications Developer": float(prediction_result_all[0][0]),
|
133 |
+
# "CRM Technical Developer": float(prediction_result_all[0][1]),
|
134 |
+
# "Database Developer": float(prediction_result_all[0][2]),
|
135 |
+
# "Mobile Applications Developer": float(prediction_result_all[0][3]),
|
136 |
+
# "Network Security Engineer": float(prediction_result_all[0][4]),
|
137 |
+
# "Software Developer": float(prediction_result_all[0][5]),
|
138 |
+
# "Software Engineer": float(prediction_result_all[0][6]),
|
139 |
+
# "Software Quality Assurance (QA)/ Testing": float(prediction_result_all[0][7]),
|
140 |
+
# "Systems Security Administrator": float(prediction_result_all[0][8]),
|
141 |
+
# "Technical Support": float(prediction_result_all[0][9]),
|
142 |
+
# "UX Designer": float(prediction_result_all[0][10]),
|
143 |
+
# "Web Developer": float(prediction_result_all[0][11]),
|
144 |
+
# }
|
145 |
# return result_list
|
146 |
|
147 |
+
# # Lists for dropdown menus (same as original code)
|
148 |
# cert_list = ["app development", "distro making", "full stack", "hadoop", "information security", "machine learning", "python", "r programming", "shell programming"]
|
149 |
# workshop_list = ["cloud computing", "data science", "database security", "game development", "hacking", "system designing", "testing", "web technologies"]
|
150 |
+
# skill = ["excellent", "medium", "poor"]
|
151 |
# subject_list = ["cloud computing", "Computer Architecture", "data engineering", "hacking", "IOT", "Management", "networks", "parallel computing", "programming", "Software Engineering"]
|
152 |
# career_list = ["Business process analyst", "cloud computing", "developer", "security", "system developer", "testing"]
|
153 |
# company_list = ["BPA", "Cloud Services", "Finance", "Product based", "product development", "SAaS services", "Sales and Marketing", "Service Based", "Testing and Maintainance Services", "Web Services"]
|
|
|
155 |
# Choice_list = ["Management", "Technical"]
|
156 |
# worker_list = ["hard worker", "smart worker"]
|
157 |
|
158 |
+
# # Create Gradio interface (modified to include model selection)
|
159 |
+
# demo = gr.Interface(
|
160 |
+
# fn=rfprediction,
|
161 |
+
# inputs=[
|
162 |
+
# gr.Dropdown(["Random Forest", "Decision Tree"], label="Select Machine Learning Model"),
|
163 |
+
# gr.Textbox(placeholder="What is your name?", label="Name"),
|
164 |
+
# gr.Slider(minimum=1, maximum=9, value=3, step=1, label="Are you a logical thinking person?", info="Scale: 1 - 9"),
|
165 |
+
# gr.Slider(minimum=0, maximum=6, value=0, step=1, label="Do you attend any Hackathons?", info="Scale: 0 - 6 | 0 - if not attended any"),
|
166 |
+
# gr.Slider(minimum=1, maximum=9, value=5, step=1, label="How do you rate your coding skills?", info="Scale: 1 - 9"),
|
167 |
+
# gr.Slider(minimum=1, maximum=9, value=3, step=1, label="How do you rate your public speaking skills/confidency?", info="Scale: 1 - 9"),
|
168 |
+
# gr.Radio({"Yes", "No"}, type="index", label="Are you a self-learning person? *"),
|
169 |
+
# gr.Radio({"Yes", "No"}, type="index", label="Do you take extra courses in uni (other than IT)? *"),
|
170 |
+
# gr.Dropdown(cert_list, label="Select a certificate you took!"),
|
171 |
+
# gr.Dropdown(workshop_list, label="Select a workshop you attended!"),
|
172 |
+
# gr.Dropdown(skill, label="Select your read and writing skill"),
|
173 |
+
# gr.Dropdown(skill, label="Is your memory capability good?"),
|
174 |
+
# gr.Dropdown(subject_list, label="What subject you are interested in?"),
|
175 |
+
# gr.Dropdown(career_list, label="Which IT-Career do you have interests in?"),
|
176 |
+
# gr.Dropdown(company_list, label="Do you have any interested company that you intend to settle in?"),
|
177 |
+
# gr.Radio({"Yes", "No"}, type="index", label="Do you ever seek any advices from senior or elders? *"),
|
178 |
+
# gr.Dropdown(book_list, label="Select your interested genre of book!"),
|
179 |
+
# gr.Radio({"Yes", "No"}, type="index", label="Are you an Introvert?| No - extrovert *"),
|
180 |
+
# gr.Radio({"Yes", "No"}, type="index", label="Ever worked in a team? *"),
|
181 |
+
# gr.Dropdown(Choice_list, label="Which area do you prefer: Management or Technical?"),
|
182 |
+
# gr.Dropdown(worker_list, label="Are you a Smart worker or Hard worker?")
|
183 |
+
# ],
|
184 |
+
# outputs=gr.Label(num_top_classes=5),
|
185 |
+
# title="IT-Career Recommendation System: TMI4033 Colletive Intelligence, Group 12",
|
186 |
+
# description="Members: Derrick Lim Kin Yeap 74597, Jason Jong Sheng Tat 75125, Jason Ng Yong Xing 75127, Muhamad Hazrie Bin Suhkery 73555 "
|
187 |
+
# )
|
188 |
+
|
189 |
+
# # Main execution
|
190 |
# if __name__ == "__main__":
|
191 |
# demo.launch(share=True)
|
192 |
|
|
|
193 |
import gradio as gr
|
194 |
import pandas as pd
|
195 |
import numpy as np
|
196 |
import pickle
|
197 |
import sklearn
|
198 |
+
import requests
|
199 |
from datasets import load_dataset
|
200 |
|
201 |
# Read the data
|
|
|
212 |
else:
|
213 |
raise ValueError("Invalid model selection")
|
214 |
|
215 |
+
# Prepare categorical data
|
216 |
categorical_cols = data[[
|
217 |
'certifications',
|
218 |
'workshops',
|
|
|
227 |
data[i] = data[i].astype('category')
|
228 |
data[i] = data[i].cat.codes
|
229 |
|
230 |
+
# Create reference dictionaries for embeddings
|
231 |
def create_embedding_dict(column):
|
232 |
unique_names = list(categorical_cols[column].unique())
|
233 |
unique_codes = list(data[column].unique())
|
|
|
240 |
company_intends_references = create_embedding_dict('Type of company want to settle in?')
|
241 |
book_interest_references = create_embedding_dict('Interested Type of Books')
|
242 |
|
243 |
+
# Prediction function (modified to fetch job details)
|
244 |
def rfprediction(model_choice, name, logical_thinking, hackathon_attend, coding_skills, public_speaking_skills,
|
245 |
self_learning, extra_course, certificate_code, worskhop_code, read_writing_skill, memory_capability,
|
246 |
subject_interest, career_interest, company_intend, senior_elder_advise, book_interest, introvert_extro,
|
|
|
248 |
# Load the selected model
|
249 |
rfmodel = load_model(model_choice)
|
250 |
|
251 |
+
# Create DataFrame
|
252 |
df = pd.DataFrame.from_dict(
|
253 |
{
|
254 |
"logical_thinking": [logical_thinking],
|
|
|
287 |
"book_interest": book_interest_references
|
288 |
})
|
289 |
|
290 |
+
# Dummy encoding
|
291 |
userdata_list = df.values.tolist()
|
292 |
|
293 |
# Management-Technical dummy encoding
|
|
|
332 |
"UX Designer": float(prediction_result_all[0][10]),
|
333 |
"Web Developer": float(prediction_result_all[0][11]),
|
334 |
}
|
335 |
+
|
336 |
+
# Get the top predicted job
|
337 |
+
job_pre = max(result_list, key=result_list.get)
|
338 |
+
|
339 |
+
# Fetch job details using RapidAPI
|
340 |
+
url = "https://jobs-api14.p.rapidapi.com/v2/list"
|
341 |
+
querystring = {
|
342 |
+
"query": job_pre,
|
343 |
+
"location": "India",
|
344 |
+
"autoTranslateLocation": "false",
|
345 |
+
"remoteOnly": "false",
|
346 |
+
"employmentTypes": "fulltime;parttime;intern;contractor"
|
347 |
+
}
|
348 |
+
headers = {
|
349 |
+
"x-rapidapi-key": "714f5a2539msh798d996c3243876p19c71ajsnfcd7ce481cb9",
|
350 |
+
"x-rapidapi-host": "jobs-api14.p.rapidapi.com"
|
351 |
+
}
|
352 |
+
|
353 |
+
try:
|
354 |
+
response = requests.get(url, headers=headers, params=querystring)
|
355 |
+
job_response = response.json()
|
356 |
+
print(job_response) # Print the response for debugging
|
357 |
+
except Exception as e:
|
358 |
+
print(f"Error fetching job details: {e}")
|
359 |
+
job_response = {}
|
360 |
+
|
361 |
return result_list
|
362 |
|
363 |
+
# Lists for dropdown menus
|
364 |
cert_list = ["app development", "distro making", "full stack", "hadoop", "information security", "machine learning", "python", "r programming", "shell programming"]
|
365 |
workshop_list = ["cloud computing", "data science", "database security", "game development", "hacking", "system designing", "testing", "web technologies"]
|
366 |
skill = ["excellent", "medium", "poor"]
|
|
|
371 |
Choice_list = ["Management", "Technical"]
|
372 |
worker_list = ["hard worker", "smart worker"]
|
373 |
|
374 |
+
# Create Gradio interface
|
375 |
demo = gr.Interface(
|
376 |
fn=rfprediction,
|
377 |
inputs=[
|