Spaces:
Sleeping
Sleeping
Commit
·
8090d99
1
Parent(s):
3ed74a8
Add an error if no search term set
Browse files
app.py
CHANGED
@@ -37,20 +37,22 @@ def get_jobs(raw_search_term, platform) -> List[JobDescription]:
|
|
37 |
|
38 |
def search_jobs(search_term, platform):
|
39 |
log_start(search_term, platform)
|
|
|
|
|
40 |
|
41 |
yield "Searching for jobs..."
|
42 |
jobs : List[JobDescription] = get_jobs(search_term, platform)
|
43 |
|
44 |
selected_jobs = filterout_jobs(jobs)
|
45 |
|
46 |
-
yield f"Found {len(selected_jobs)}. Analysing..."
|
47 |
-
|
48 |
#db = Database()
|
49 |
#db.add_to_db(selected_jobs)
|
50 |
|
51 |
if len(selected_jobs) == 0:
|
52 |
-
|
|
|
53 |
|
|
|
54 |
result = ["<style>.job{display: flex;width:70%;margin: 5px auto;border: 1px solid;border-radius: 5px;}.logobox{flex: 1;display: flex;align-items: center;justify-content: center;}.logo{width:100px;height:100px}h4{margin: 2px;}</style>"]
|
55 |
for job in selected_jobs:
|
56 |
job.ai_result = get_extra_information(job.company, job.job_description)
|
|
|
37 |
|
38 |
def search_jobs(search_term, platform):
|
39 |
log_start(search_term, platform)
|
40 |
+
if search_term == "":
|
41 |
+
raise gr.Error("No search term selected")
|
42 |
|
43 |
yield "Searching for jobs..."
|
44 |
jobs : List[JobDescription] = get_jobs(search_term, platform)
|
45 |
|
46 |
selected_jobs = filterout_jobs(jobs)
|
47 |
|
|
|
|
|
48 |
#db = Database()
|
49 |
#db.add_to_db(selected_jobs)
|
50 |
|
51 |
if len(selected_jobs) == 0:
|
52 |
+
yield "No job found"
|
53 |
+
return
|
54 |
|
55 |
+
yield f"Found {len(selected_jobs)}. Analysing..."
|
56 |
result = ["<style>.job{display: flex;width:70%;margin: 5px auto;border: 1px solid;border-radius: 5px;}.logobox{flex: 1;display: flex;align-items: center;justify-content: center;}.logo{width:100px;height:100px}h4{margin: 2px;}</style>"]
|
57 |
for job in selected_jobs:
|
58 |
job.ai_result = get_extra_information(job.company, job.job_description)
|