dielz commited on
Commit
6a482cd
·
verified ·
1 Parent(s): c1f7985

delete radius

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -73,7 +73,7 @@ def normalize_distance(distances):
73
  return normalized
74
 
75
  # Menambahkan radius sebagai parameter
76
- def prepare_and_recommend(df, user_skills, user_location, radius_km):
77
  # 1. Memastikan dataset memiliki koordinat
78
  if 'latitude' not in df or 'longitude' not in df:
79
  raise ValueError("Dataset harus memiliki kolom latitude dan longitude")
@@ -100,7 +100,7 @@ def prepare_and_recommend(df, user_skills, user_location, radius_km):
100
  df['distance (km)'] = distances
101
 
102
  # 5. Filter pekerjaan berdasarkan radius
103
- df = df[df['distance (km)'] <= radius_km]
104
 
105
  # 6. Normalisasi jarak
106
  if not df.empty:
@@ -118,16 +118,15 @@ def prepare_and_recommend(df, user_skills, user_location, radius_km):
118
  return top_jobs[['job_link', 'title', 'company', 'location', 'distance (km)', 'final score']]
119
 
120
  # Streamlit app
121
- st.title('Job Recommendation System')
122
- st.write('Enter your skills and location to get job recommendations.')
123
 
124
  user_skills = st.text_input('Enter your skills (comma-separated):')
125
- user_location = st.text_input('Enter your location:')
126
- radius_km = st.number_input('Enter your preferred radius (in km):', min_value=1, value=10)
127
 
128
  if st.button('Get Recommendations'):
129
  if user_skills and user_location:
130
- recommended_jobs = prepare_and_recommend(sample_data, user_skills, user_location, radius_km)
131
  if recommended_jobs.empty:
132
  st.warning('Tidak ditemukan pekerjaan yang sesuai dengan keterampilan dan lokasi Anda.')
133
  elif recommended_jobs['final score'].max() < 0.02:
 
73
  return normalized
74
 
75
  # Menambahkan radius sebagai parameter
76
+ def prepare_and_recommend(df, user_skills, user_location):
77
  # 1. Memastikan dataset memiliki koordinat
78
  if 'latitude' not in df or 'longitude' not in df:
79
  raise ValueError("Dataset harus memiliki kolom latitude dan longitude")
 
100
  df['distance (km)'] = distances
101
 
102
  # 5. Filter pekerjaan berdasarkan radius
103
+ df = df[df['distance (km)']]
104
 
105
  # 6. Normalisasi jarak
106
  if not df.empty:
 
118
  return top_jobs[['job_link', 'title', 'company', 'location', 'distance (km)', 'final score']]
119
 
120
  # Streamlit app
121
+ st.title('Job Findr')
122
+ st.write('Find your job with ease.')
123
 
124
  user_skills = st.text_input('Enter your skills (comma-separated):')
125
+ user_location = st.text_input('Job location:')
 
126
 
127
  if st.button('Get Recommendations'):
128
  if user_skills and user_location:
129
+ recommended_jobs = prepare_and_recommend(sample_data, user_skills, user_location)
130
  if recommended_jobs.empty:
131
  st.warning('Tidak ditemukan pekerjaan yang sesuai dengan keterampilan dan lokasi Anda.')
132
  elif recommended_jobs['final score'].max() < 0.02: