jeanflop commited on
Commit
d92c7ab
·
verified ·
1 Parent(s): 4a53bad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -7,17 +7,7 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
- ## utils
11
- def format_job(job):
12
- return (
13
- f"Company: {job.get('company_name', 'Unknown Company')}\n"
14
- f"Job Title: {job.get('title', 'No title available')}\n"
15
- f"Location: {job.get('location', 'Unknown Location')}\n"
16
- f"Remote: {job.get('work_type', 'Unknown Work Type')}\n"
17
- f"Posted Time: {job.get('posted_at', 'Unknown Time')}\n"
18
- f"Job URL: {job.get('job_url', 'No URL available')}\n"
19
- f"{'=' * 80}"
20
- )
21
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
22
  @tool
23
  def my_job_tool(arg1: str)-> str: #it's import to specify the return type
@@ -53,8 +43,14 @@ def my_job_tool(arg1: str)-> str: #it's import to specify the return type
53
  }
54
 
55
  response = requests.post(url, json=payload, headers=headers)
56
- jobs = response.json()
57
- result = "\n".join(map(format_job, jobs[:3]))
 
 
 
 
 
 
58
  return result
59
 
60
  except Exception as e:
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+
 
 
 
 
 
 
 
 
 
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
  def my_job_tool(arg1: str)-> str: #it's import to specify the return type
 
43
  }
44
 
45
  response = requests.post(url, json=payload, headers=headers)
46
+ jobs = response.json().get("data", [])[:5]
47
+
48
+ return "\n\n".join(
49
+ f"{job.get('job_title', 'No title')} at {job.get('company', 'Unknown company')}\n"
50
+ f"Location: {job.get('location', 'Unknown location')}\n"
51
+ f"Link: {job.get('job_url', 'No URL')}"
52
+ for job in jobs
53
+ )
54
  return result
55
 
56
  except Exception as e: