From bed6ce22f5e5fe28a8ebdcbab61d3b77960c42d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=83=81=ED=98=B8=20Sangho=20Park?= Date: Thu, 28 Aug 2025 10:26:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=EA=B2=BD=EB=A1=9C=EB=A5=BC=20model=5FDev/data?= =?UTF-8?q?=EB=A1=9C=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AI_Web_Scraper/config.json | 2 +- AI_Web_Scraper/main.py | 14 +++++++++++++- AI_Web_Scraper/run_guide.md | 22 ++++++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/AI_Web_Scraper/config.json b/AI_Web_Scraper/config.json index f36d689..3be4734 100644 --- a/AI_Web_Scraper/config.json +++ b/AI_Web_Scraper/config.json @@ -13,6 +13,6 @@ "data_storage": { "local_storage_path": "./collected_data", "file_format": "json", - "drive_mount_path": "/content/drive/MyDrive/AI_Data" + "drive_mount_path": "/content/drive/MyDrive/model_Dev/data" } } diff --git a/AI_Web_Scraper/main.py b/AI_Web_Scraper/main.py index 31f97fb..69cb48f 100644 --- a/AI_Web_Scraper/main.py +++ b/AI_Web_Scraper/main.py @@ -9,6 +9,7 @@ def main(): parser.add_argument('--topics', nargs='+', help='수집할 주제 목록', default=None) parser.add_argument('--config', default='./config.json', help='설정 파일 경로') parser.add_argument('--auto-topics', action='store_true', help='AI가 스스로 주제를 선정하여 조사') + parser.add_argument('--save-path', help='데이터 저장 경로 (예: /content/drive/MyDrive/MyFolder)', default=None) args = parser.parse_args() @@ -22,7 +23,18 @@ def main(): print("모델 다운로드 실패. 프로그램을 종료합니다.") sys.exit(1) - # 2. AI 에이전트 초기화 + # 2. 설정 파일 로드 및 수정 + with open(args.config, 'r') as f: + config = json.load(f) + + if args.save_path: + config['data_storage']['drive_mount_path'] = args.save_path + # 수정된 config 저장 + with open(args.config, 'w') as f: + json.dump(config, f, indent=2) + print(f"저장 경로 설정됨: {args.save_path}") + + # 3. AI 에이전트 초기화 print("AI 에이전트 초기화 중...") agent = AIAgent(args.config) diff --git a/AI_Web_Scraper/run_guide.md b/AI_Web_Scraper/run_guide.md index 8c9f55c..b534f6e 100644 --- a/AI_Web_Scraper/run_guide.md +++ b/AI_Web_Scraper/run_guide.md @@ -50,18 +50,18 @@ drive.mount('/content/drive') !pip install -r requirements.txt ``` -### 2.2 설정 파일 수정 -`config.json` 파일을 열어서 다음 항목들을 수정: +### 2.2 설정 파일 수정 (선택사항) +기본적으로 데이터는 `/content/drive/MyDrive/AI_Data`에 저장됩니다. 다른 경로를 원하시면 `config.json`의 `drive_mount_path`를 수정하세요: + ```json { - "google_drive_folder_id": "YOUR_ACTUAL_FOLDER_ID", - "google_credentials_path": "./credentials.json" + "data_storage": { + "drive_mount_path": "/content/drive/MyDrive/MyCustomFolder" + } } ``` -### 2.3 인증 파일 업로드 -- `credentials.json` 파일을 Colab에 업로드 -- Google Drive 인증 시 브라우저 팝업이 나타나면 허용 +또는 실행 시 `--save-path` 옵션으로 지정할 수 있습니다. ## 3. 시스템 실행 @@ -86,12 +86,18 @@ python main.py --topics "인공지능" "머신러닝" "딥러닝" python main.py --config ./custom_config.json ``` +### 3.5 저장 경로 지정 +```bash +python main.py --save-path "/content/drive/MyDrive/MyCustomFolder" +``` +이렇게 하면 데이터를 지정한 폴더에 저장합니다. + ## 4. 실행 과정 설명 1. **모델 다운로드**: Hugging Face에서 `jxm/gpt-oss-20b-base` 모델을 다운로드 2. **AI 에이전트 초기화**: 모델을 로드하고 도구들을 설정 3. **정보 수집**: 각 주제에 대해 AI가 스스로 웹을 탐색하며 정보 수집 -4. **데이터 저장**: 수집된 데이터를 마운트된 Google Drive의 `/content/drive/MyDrive/AI_Data` 폴더에 자동 저장 +4. **데이터 저장**: 수집된 데이터를 마운트된 Google Drive의 지정된 폴더에 자동 저장 ## 5. 모니터링 및 디버깅