/flask-summary

a python flask web-app using Bert to do summarization

Primary LanguagePython

Flask Summary

** Partial was originally from https://github.com/dmmiller612/lecture-summarizer.git **

Features

  • generate summary on given text

Train and Use the model generate by BertSum

please follow this documents about how to train and use the model generated by BertSum

Installation In A Nutshell (on localhost)

  1. clone this project to your local disk
 git clone https://github.com/Quan25/flask-summary.git
  1. Install Flask
  2. Install ROUGE-1.5.5
  • Install libxml-parser-perl, it is essential for installing ROUGE-1.5.5
  sudo apt-get install libxml-parser-perl
  • and make sure you can run this, which means the ROUGE is successfully installed
  ./runROUGE-test.pl
  1. Install pyrouge
 git clone https://github.com/bheinzerling/pyrouge.git
 cd pyrouge
 pip install -e .
  • Additional information can be found here about how to install pyrouge and running the test
  1. Please install pytorch 1.1.0 with this comand
  • GPU
  conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=10.0 -c pytorch
  • CPU Only
  conda install pytorch-cpu==1.1.0 torchvision-cpu==0.3.0 cpuonly -c pytorch
  1. Download pretrained-bert-model, and unzip it to a location you like
  2. Change the path in BertParent.py in summarizer folder
 self.model = BertModel.from_pretrained('/path/to/bert-large-uncased')
  1. Run python app.py in the flask-summary directory.
  2. Start web server by running python app.py while in the server_example directory.
  3. Browse the examples at 0.0.0.0:5000 using a browser. (defaults to port 5000)

Screen Demo

Screen Demo