Spaces:
Sleeping
Sleeping
Gabriel
commited on
Commit
·
18c9df7
1
Parent(s):
63e2fd7
debug
Browse files
app.py
CHANGED
@@ -25,46 +25,33 @@ def calc_preds(coeffs, indeps):
|
|
25 |
return 'Real Job Post'
|
26 |
else:
|
27 |
return 'Fake Job Post'
|
28 |
-
# return torch.sigmoid(res)
|
29 |
-
|
30 |
-
|
31 |
-
def preprocess_input(input_data):
|
32 |
-
df = pd.DataFrame([input_data], columns=indep_cols)
|
33 |
-
|
34 |
-
for column in df.columns:
|
35 |
-
if df[column].dtype == 'O': # 'O' stands for object type (string)
|
36 |
-
df[column] = label_encoder.fit_transform(df[column])
|
37 |
-
else:
|
38 |
-
df[column] = df[column].astype(float)
|
39 |
-
|
40 |
-
t_indep = tensor(df[indep_cols].values, dtype=torch.float)
|
41 |
-
vals, indices = t_indep.max(dim=0)
|
42 |
-
t_indep = t_indep / vals
|
43 |
-
|
44 |
-
return t_indep
|
45 |
-
|
46 |
-
# def main(inputs):
|
47 |
-
# t_indep = preprocess_input(inputs)
|
48 |
-
# return calc_preds(coeffs, t_indep)
|
49 |
|
50 |
def main(job_title, company_name, company_desc, job_desc,
|
51 |
job_requirement, salary, location, employment_type,
|
52 |
department):
|
53 |
-
|
|
|
54 |
job_requirement, salary, location, employment_type,
|
55 |
department]
|
56 |
|
57 |
-
|
|
|
58 |
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
|
62 |
iface = gr.Interface(
|
63 |
fn=main,
|
64 |
-
inputs="
|
|
|
|
|
|
|
|
|
65 |
outputs="text",
|
66 |
-
title="
|
67 |
-
description="Identifies job posts as real or fake
|
68 |
)
|
69 |
|
70 |
iface.launch()
|
|
|
25 |
return 'Real Job Post'
|
26 |
else:
|
27 |
return 'Fake Job Post'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
def main(job_title, company_name, company_desc, job_desc,
|
30 |
job_requirement, salary, location, employment_type,
|
31 |
department):
|
32 |
+
df = pd.DataFrame(columns=indep_cols)
|
33 |
+
df.loc[0] = [job_title, company_name, company_desc, job_desc,
|
34 |
job_requirement, salary, location, employment_type,
|
35 |
department]
|
36 |
|
37 |
+
for column in df.columns:
|
38 |
+
df[column] = label_encoder.fit_transform(df[column])
|
39 |
|
40 |
+
t_indep = tensor(df[indep_cols].values, dtype=torch.float)
|
41 |
+
vals,indices = t_indep.max(dim=0)
|
42 |
+
t_indep = t_indep / vals
|
43 |
+
return calc_preds(coeffs, t_indep)
|
44 |
|
45 |
iface = gr.Interface(
|
46 |
fn=main,
|
47 |
+
inputs=[gr.Textbox(label="Job title"), gr.Textbox(label="Company name"),
|
48 |
+
gr.Textbox(label="Company description"), gr.Textbox(label="Job description"),
|
49 |
+
gr.Textbox(label="Job Requirements"), gr.Textbox(label="Salary"),
|
50 |
+
gr.Textbox(label="Location"), gr.Textbox(label="Employment Type"),
|
51 |
+
gr.Textbox(label="Department")],
|
52 |
outputs="text",
|
53 |
+
title="Job posting identifier",
|
54 |
+
description="Identifies job posts as real or fake"
|
55 |
)
|
56 |
|
57 |
iface.launch()
|