Spaces:
Sleeping
Sleeping
helloguddn (PC helloguddn)
feat: 의존성, chat 엔드포인트, gemini function calling, 이미지 추출, Maps 연동, 노동법 RAG(google.text-embedding-004)
f4bf832 Download tools/public_data_tool.py from helloguddn/Suwon_multiculturalism: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/helloguddn/Suwon_multiculturalism/resolve/main/tools/public_data_tool.py
- Command line
-
hf download hf://spaces/helloguddn/Suwon_multiculturalism/tools/public_data_tool.py
-
curl -L -o public_data_tool.py https://huggingface.co/spaces/helloguddn/Suwon_multiculturalism/resolve/main/tools/public_data_tool.py
1.06 kB
| """Public support center data lookup tool (CSV-based).""" | |
| from __future__ import annotations | |
| import os | |
| import pandas as pd | |
| _df: pd.DataFrame | None = None | |
| _DATA_PATH = os.path.join(os.path.dirname(__file__), "../data/public_centers.csv") | |
| def _load() -> pd.DataFrame: | |
| global _df | |
| if _df is None: | |
| _df = pd.read_csv(_DATA_PATH, dtype={"phone": str}) | |
| return _df | |
| def get_center_info(center_type: str = "all") -> str: | |
| """수원시 외국인 지원 기관의 목록과 연락처를 조회합니다. | |
| Args: | |
| center_type: 'labor'(노동청), 'welfare'(복지센터), 'legal'(법률상담), 'all'(전체) | |
| Returns: | |
| 기관 목록 텍스트 | |
| """ | |
| df = _load() | |
| if center_type != "all": | |
| df = df[df["type"] == center_type] | |
| if df.empty: | |
| return "해당 유형의 기관 정보를 찾을 수 없습니다." | |
| lines = [ | |
| f"- {row['name']} | 주소: {row['address']} | 전화: {row['phone']} | 운영: {row['hours']}" | |
| for _, row in df.iterrows() | |
| ] | |
| return "\n".join(lines) | |