Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,49 +1,3 @@
|
|
| 1 |
-
Hugging Face's logo
|
| 2 |
-
Hugging Face
|
| 3 |
-
Models
|
| 4 |
-
Datasets
|
| 5 |
-
Spaces
|
| 6 |
-
Community
|
| 7 |
-
Docs
|
| 8 |
-
Enterprise
|
| 9 |
-
Pricing
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
Spaces:
|
| 14 |
-
|
| 15 |
-
OppaAI
|
| 16 |
-
/
|
| 17 |
-
Job-Search-MCP-Server
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
like
|
| 21 |
-
0
|
| 22 |
-
|
| 23 |
-
Logs
|
| 24 |
-
App
|
| 25 |
-
Files
|
| 26 |
-
Community
|
| 27 |
-
Settings
|
| 28 |
-
Job-Search-MCP-Server
|
| 29 |
-
/
|
| 30 |
-
app.py
|
| 31 |
-
|
| 32 |
-
OppaAI's picture
|
| 33 |
-
OppaAI
|
| 34 |
-
Update app.py
|
| 35 |
-
bfad4de
|
| 36 |
-
verified
|
| 37 |
-
2 minutes ago
|
| 38 |
-
raw
|
| 39 |
-
|
| 40 |
-
Copy download link
|
| 41 |
-
history
|
| 42 |
-
blame
|
| 43 |
-
edit
|
| 44 |
-
delete
|
| 45 |
-
|
| 46 |
-
4.36 kB
|
| 47 |
import gradio as gr
|
| 48 |
from fastmcp import FastMCP
|
| 49 |
import logging
|
|
@@ -60,12 +14,14 @@ mcp = FastMCP("Jobicy Canada Remote Jobs Agent")
|
|
| 60 |
def search_jobs_tool(query: str, location: str, limit: int = 10, salary: str = None, job_type: str = None) -> dict:
|
| 61 |
"""
|
| 62 |
Use Jobicy's Remote Jobs API to search remote jobs in Canada.
|
|
|
|
| 63 |
Args:
|
| 64 |
query (str): Keyword or job title to search for.
|
| 65 |
location (str): Location filter (ignored since it's remote, but kept for API compatibility).
|
| 66 |
limit (int): Max number of jobs to return (max 50).
|
| 67 |
salary (str): Ignored (for compatibility).
|
| 68 |
job_type (str): Ignored (for compatibility).
|
|
|
|
| 69 |
Returns:
|
| 70 |
dict: Contains 'jobs' list or 'error' message.
|
| 71 |
"""
|
|
@@ -86,13 +42,21 @@ def search_jobs_tool(query: str, location: str, limit: int = 10, salary: str = N
|
|
| 86 |
jobs_raw = data.get("jobs", [])
|
| 87 |
jobs = []
|
| 88 |
for job in jobs_raw:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
jobs.append({
|
| 90 |
"title": job.get("jobTitle", "No Title"),
|
| 91 |
"company": job.get("companyName", "Unknown Company"),
|
| 92 |
"location": job.get("jobGeo", "Remote"),
|
| 93 |
"url": job.get("url", "#"),
|
| 94 |
"pubDate": job.get("pubDate", "Unknown Date"),
|
| 95 |
-
"salary":
|
| 96 |
})
|
| 97 |
|
| 98 |
logger.info(f"Found {len(jobs)} jobs from Jobicy.")
|
|
@@ -159,4 +123,3 @@ app = gr.Interface(
|
|
| 159 |
|
| 160 |
if __name__ == "__main__":
|
| 161 |
app.launch(mcp_server=True)
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastmcp import FastMCP
|
| 3 |
import logging
|
|
|
|
| 14 |
def search_jobs_tool(query: str, location: str, limit: int = 10, salary: str = None, job_type: str = None) -> dict:
|
| 15 |
"""
|
| 16 |
Use Jobicy's Remote Jobs API to search remote jobs in Canada.
|
| 17 |
+
|
| 18 |
Args:
|
| 19 |
query (str): Keyword or job title to search for.
|
| 20 |
location (str): Location filter (ignored since it's remote, but kept for API compatibility).
|
| 21 |
limit (int): Max number of jobs to return (max 50).
|
| 22 |
salary (str): Ignored (for compatibility).
|
| 23 |
job_type (str): Ignored (for compatibility).
|
| 24 |
+
|
| 25 |
Returns:
|
| 26 |
dict: Contains 'jobs' list or 'error' message.
|
| 27 |
"""
|
|
|
|
| 42 |
jobs_raw = data.get("jobs", [])
|
| 43 |
jobs = []
|
| 44 |
for job in jobs_raw:
|
| 45 |
+
salary_min = job.get("annualSalaryMin")
|
| 46 |
+
salary_max = job.get("annualSalaryMax")
|
| 47 |
+
currency = job.get("salaryCurrency", "")
|
| 48 |
+
if salary_min and salary_max:
|
| 49 |
+
salary_str = f"{salary_min} - {salary_max} {currency}".strip()
|
| 50 |
+
else:
|
| 51 |
+
salary_str = "Not specified"
|
| 52 |
+
|
| 53 |
jobs.append({
|
| 54 |
"title": job.get("jobTitle", "No Title"),
|
| 55 |
"company": job.get("companyName", "Unknown Company"),
|
| 56 |
"location": job.get("jobGeo", "Remote"),
|
| 57 |
"url": job.get("url", "#"),
|
| 58 |
"pubDate": job.get("pubDate", "Unknown Date"),
|
| 59 |
+
"salary": salary_str
|
| 60 |
})
|
| 61 |
|
| 62 |
logger.info(f"Found {len(jobs)} jobs from Jobicy.")
|
|
|
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
| 125 |
app.launch(mcp_server=True)
|
|
|