인공지능, 머신러닝 41

[Crawling] 네이버, 구글에 검색어 입력 후 엔터키

1. 네이버에서 검색하기 from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import os from selenium.webdriver.chrome.service import Service as ChromeService from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By # 크롤링할 키워드 입력 query_txt = input('크롤링할 키워드는 무엇인가요?:') # 결과를 저장할 파일 경로 f_name = 'C:\\Users\\Desktop\\0418test\\te..

[Crawling] 구글 드라이버 _ webdriver_manager

1. Anaconda Prompt 창 열기 webdriver_manager 설치 pip install webdriver_manager 2. 코드 from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) * 관련 링크 https://pypi.org/project/webdriver-manager/ webdriver-manager Library provides the way to automatically manage drivers for different browsers pypi.org

[Crawling] Chrome Driver 설치하기

* Chrome Driver 설치 사이트 1. 최신 버전 https://googlechromelabs.github.io/chrome-for-testing/ Chrome for Testing availability chrome-headless-shellmac-arm64https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.122/mac-arm64/chrome-headless-shell-mac-arm64.zip200 googlechromelabs.github.io 2. 오래된 버전 https://chromedriver.chromium.org/downloads ChromeDriver - WebDriver for Chrome - Downloads..

[Pytorch] Anaconda를 활용하여 Pytorch 설치하기

1. Anaconda Prompt 접속 2. 가상환경 만들기 명령어를 사용하여 가상 환경을 만듭니다. conda create -n 이름 3. 가상환경 확인 conda env list conda info --envs 여기서 *은 현재 사용하고 있다는 뜻이다. 4. 가상환경 들어가기 conda activate 이름 5. Pytorch 설치하기 https://pytorch.org/get-started/locally/ 사이트에 들어가서 자신의 컴퓨터의 환경에 맞게 체크해주시면 아래에 명령어가 뜬다 conda install pytorch torchvision torchaudio cpuonly -c pytorch 6. Pytorch 설치 확인하기 python import torch torch.rand(10) 잘 출..

[Django prac][weather graph] 5. 날씨 데이터 가져오기

* 캐글 홈페이지에서 데이터 다운받기 2013-12-21 ~ 2017-07-31 까지의 일별 날씨 데이터 https://www.kaggle.com/datasets/grubenm/austin-weather # myapps > data myapps에 data 폴더를 만든다 여기로 다운받은 데이터 옮기기 # myapps > views.py csv_path = 'myapps/data/austin_weather.csv' df = pd.read_csv(csv_path) 이미지 데이터 경로 설정하기

[Django prac][weather graph] 4. View에서 Template으로 이미지 전달하기

▷ View에서 Template으로 이미지 전달하기 View에서 Template으로 이미지 형식의 데이터를 직접 전달할 수 없다. 그래서 저장된 이미지의 경로를 전달하여 Template에서 출력해야한다. 지금은 matplotlib 그래프를 이미지의 형식으로 버퍼에 저장한 후 그 지정된 경로를 전달할 것이다. * 버퍼 (buffer) 데이터를 임시로 저장하는 공간 # myapps > vies.py from django.shortcuts import render import matplotlib.pyplot as plt import pandas as pd # io : 입출력 연산을 위한 Python 표준 라이브러리 # BytesIO : 이진 데이터를 다루기 위한 버퍼를 제공 from io import Byte..

[Django prac][weather graph] 3. 경로 설정

# myapps > templates templates 폴더 만들기 index.html 생성 메인페이지 # myapps > views.py from django.shortcuts import render import matplotlib.pyplot as plt def index(request): x = [1, 2, 3, 4] y = [2, 4, 6, 8] plt.plot(x,y) plt.title("test graph") plt.xlabel('x label') plt.ylabel('y label') plt.show() return render(request, "index.html") # 서버 실행해서 결과 확인 save all python manage.py runserver http://127.0.0.1..

[Django prac][weather graph] 2. 경로 설정

# weather > urls.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('myapps/', include('myapps.urls')), ] # myapps > urls.py 새로 파일을 만들어줘야한다. from django.urls import path from . import views app_name="myapps" urlpatterns = [ path('',views.index) ] # myapps > views.py from django.shortcuts import render def index(request)..