Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

chiksumwong/news_analysis_chatbot

Repository files navigation

CircleCI

News Analysis Chatbot

Install package by using requirements.txt

$ pip install -r requirements.txt

Start Server

$ python manage.py runserver

Database

Create migrations file in app by model

$ python manage.py makemigrations

Create a file to update the database

$ python manage.py migrate

Create Admin

$ python manage.py createsuperuser --email admin@example.com --username admin

APIs

More APIs Information:

Or

  • Import Chatbot.postman_collection.json to Postman

Account APIs

APIs Method Urls
Register POST http://127.0.0.1:8000/user/register/
Login POST http://127.0.0.1:8000/user/login/

Chatbot APIs (Heroku, LINE Message API)

APIs Method Urls
Web hook POST http://127.0.0.1:8000/chatbot/webhook/

News Analysis APIs

APIs Method Urls
News Analysis By Text POST http://127.0.0.1:8000/api/checknews/
News Analysis By URL POST http://127.0.0.1:8000/api/checknewsbyurl/
Check News Detail By URL POST http://127.0.0.1:8000/api/newsinfo/

News APIs

APIs Method Urls
Create News POST http://127.0.0.1:8000/api/news/
Get All News GET http://127.0.0.1:8000/api/news/
Get News By ID GET http://127.0.0.1:8000/api/news/:news_id/
Update News PUT http://127.0.0.1:8000/api/news/:news_id/
Delete News DELETE http://127.0.0.1:8000/api/news/:news_id/

Chatbot Record APIs

APIs Method Urls
Create Record POST http://127.0.0.1:8000/api/record/
Get All Record GET http://127.0.0.1:8000/api/record/
Get Record By ID GET http://127.0.0.1:8000/api/record/:record_id/
Update Record PUT http://127.0.0.1:8000/api/record/:record_id/
Delete Record DELETE http://127.0.0.1:8000/api/record/:record_id/

Model training

$ python model_training/ModelTrain.py

Model evaluation

$ python model_training/ModelEvaluate.py

Model testing

$ python model_training/ModelTest.py

Model update

  1. Download the news dataset from dashboard (heroku)
  2. Rename the csv file to "UP" + timestamp
  3. Put the file to input_labelled_news folder
  4. Run the follow code
$ python model_training/ModelUpdate.py

Heroku View Log

$ heroku login

$ heroku logs -t -a news-analysis-chatbot

Heroku database migrate

$ heroku run python manage.py migrate -a news-analysis-chatbot

Release python environment

$ pip freeze > requirements.txt

Chatbot

LINE LINE LINE

Dashboard

https://news-analysis-chatbot-frontend.herokuapp.com/

Dashboard

True news websites:

Fake news websites: