코딩

[Chatbot] 간단한 챗봇 만들기

obin01 2024. 10. 2. 20:50

1. Anaconda 가상환경

1) 설치 - https://www.anaconda.com/download    ( conda : 24.11.2 - 2024.12.29)

 

Download Anaconda Distribution | Anaconda

Download Anaconda's open-source Distribution today. Discover the easiest way to perform Python/R data science and machine learning on a single machine.

www.anaconda.com

 

2) 가상환경 생성

Anaconda Navigator 접속후 Environment 에서 가상환경 생성 - python 3.7.16

 

3) kochat 필요 라이브러리 설치

conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda install JPype1=1.2.0
# pip install kochat -> kochat 라이브러리는 cpu로 돌리는데 문제가 있어 내부 kochat으로 대체
pip install kocrawl

 

2. git clone

git clone https://github.com/hyunwoongko/kochat.git test-kochat

 

3. 파일 수정

1) requirements.txt

matplotlib==3.2.1
pandas==1.0.4
gensim==3.8.3
konlpy==0.5.2
#numpy==1.18.5
numpy==1.19.1
joblib==0.15.1
scikit-learn==0.23.1
pytorch-crf==0.7.2
requests==2.24.0
flask==1.1.2
jinja2<3.1.0
itsdangerous==2.0.1
werkzeug==2.0.3
tweepy==3.10.0

 

2) demo/application.py

# from demo.scenario import dust, weather, travel, restaurant
from scenario import dust, weather, travel, restaurant




if __name__ == '__main__':
    kochat.app.template_folder = kochat.root_dir + 'templates'
    kochat.app.static_folder = kochat.root_dir + 'static'
    kochat.app.run(port=8080, host='127.0.0.1', debug=True)

 

3) \utils\visualizer.py, \proc\utils\visualizer.py

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
--> 위에 세줄로 변경
from matplotlib import pyplot as plt

 

4) kochat_config.py

    # "device": "cuda" if torch.cuda.is_available() else "cpu",
    "device": "cpu",

 

5) kochat 폴더를 demo 폴더 안으로 이동

4. 라이브러리 설치

pip install -r .\requirements.txt

 

5. 실행

cd [해당 demo 파일 위치]
python application.py

 

'코딩' 카테고리의 다른 글

[Hugo] 정적 포트폴리오 만들기  (1) 2024.12.10
[Chatbot] kochat 구조  (1) 2024.10.31
[Chatbot] 챗봇  (2) 2024.10.02
[React-Native] web 정리  (0) 2023.10.12
[JavaScript] 자주 쓰는 함수 정리  (0) 2021.11.22