Spaces:
Sleeping
Sleeping
LijinDurairaj
commited on
Commit
·
e73f8ea
1
Parent(s):
f93a065
resolving error
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import os
|
|
10 |
import pandas as pd
|
11 |
from datetime import datetime
|
12 |
import json
|
|
|
13 |
|
14 |
|
15 |
|
@@ -48,6 +49,10 @@ def intializeFAISS(docs):
|
|
48 |
print('--intialization method--')
|
49 |
print(ex)
|
50 |
|
|
|
|
|
|
|
|
|
51 |
|
52 |
def prepare_doc(r):
|
53 |
_content=f'''{r['Salutation']} {r['Initial']} {r['Name']}, Employee Id is {r['Employee Id']} and user id is {r['User Id']}, is from country {r['Country']}, Supervisor / Manager name is {r['Supervisor / Manager']} and Contracting Company is {r['Contracting Company']}, Primary Industry is {r['Primary Industry']} and Secondary Industry is {r['Secondary Industry']}, there Sector is {r['Sector']}, they are expertise in {r['Expertise']}, there role is {r['Industry Role']}. There last Last Promotion Date is {r['Last Promotion Date']} and {r['Last Promotional Level']}, There Job Title is {r['Job Title']}, they are working here since {r['Professional Since']}, there hired date is {r['Hired Date']}, there Relevant is {r['Relevant']}, Employee Sponser is {r['Employee Sponser']}, Job Description is {r['Job Description']}, Emergency Contact Name is {r['Emergency Contact Name']} and Emergency Contact Number is {r['Emergency Contact Number']}, Regional Supervisor is {r['Regional Supervisor']} Office Supervisor is {r['Office Supervisor']} Engagement Supervisor is {r['Engagement Supervisor']} '''
|
@@ -101,8 +106,7 @@ def on_submission(question):
|
|
101 |
})
|
102 |
|
103 |
if prediction:
|
104 |
-
|
105 |
-
print(type(df))
|
106 |
|
107 |
|
108 |
except Exception as ex:
|
@@ -113,10 +117,18 @@ def on_submission(question):
|
|
113 |
uploaded_file=st.file_uploader(label='please upload your file',type=['csv'])
|
114 |
|
115 |
if uploaded_file is not None:
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
#intialize form
|
122 |
with st.form(key='workforce_management'):
|
|
|
10 |
import pandas as pd
|
11 |
from datetime import datetime
|
12 |
import json
|
13 |
+
import re
|
14 |
|
15 |
|
16 |
|
|
|
49 |
print('--intialization method--')
|
50 |
print(ex)
|
51 |
|
52 |
+
def dummy(r):
|
53 |
+
return{
|
54 |
+
|
55 |
+
}
|
56 |
|
57 |
def prepare_doc(r):
|
58 |
_content=f'''{r['Salutation']} {r['Initial']} {r['Name']}, Employee Id is {r['Employee Id']} and user id is {r['User Id']}, is from country {r['Country']}, Supervisor / Manager name is {r['Supervisor / Manager']} and Contracting Company is {r['Contracting Company']}, Primary Industry is {r['Primary Industry']} and Secondary Industry is {r['Secondary Industry']}, there Sector is {r['Sector']}, they are expertise in {r['Expertise']}, there role is {r['Industry Role']}. There last Last Promotion Date is {r['Last Promotion Date']} and {r['Last Promotional Level']}, There Job Title is {r['Job Title']}, they are working here since {r['Professional Since']}, there hired date is {r['Hired Date']}, there Relevant is {r['Relevant']}, Employee Sponser is {r['Employee Sponser']}, Job Description is {r['Job Description']}, Emergency Contact Name is {r['Emergency Contact Name']} and Emergency Contact Number is {r['Emergency Contact Number']}, Regional Supervisor is {r['Regional Supervisor']} Office Supervisor is {r['Office Supervisor']} Engagement Supervisor is {r['Engagement Supervisor']} '''
|
|
|
106 |
})
|
107 |
|
108 |
if prediction:
|
109 |
+
text=str(prediction['answers'][0])
|
|
|
110 |
|
111 |
|
112 |
except Exception as ex:
|
|
|
117 |
uploaded_file=st.file_uploader(label='please upload your file',type=['csv'])
|
118 |
|
119 |
if uploaded_file is not None:
|
120 |
+
try:
|
121 |
+
df=pd.read_csv(uploaded_file)
|
122 |
+
employee_list=df.to_json(orient='records')
|
123 |
+
doc=[]
|
124 |
+
json_emp=json.loads(employee_list)
|
125 |
+
for e in json_emp:
|
126 |
+
doc.append(prepare_doc(e))
|
127 |
+
|
128 |
+
intializeFAISS(docs=doc)
|
129 |
+
except Exception as ex:
|
130 |
+
print('--uploaded_file method--')
|
131 |
+
print(ex)
|
132 |
|
133 |
#intialize form
|
134 |
with st.form(key='workforce_management'):
|