Skip to content

Commit

Permalink
demo-model
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSears1 committed Apr 30, 2024
1 parent 4f1e354 commit d3d959c
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 1,734 deletions.
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
# Your Terms: A text classifier that identifies potentially unfair or exploitative clauses in Terms and Conditions agreements

It's no secret that
- A simple web UI using Flask to support a demo of the project
- A command-line interface to support running different stages of the project's pipeline
- The ability to easily reproduce your work on another machine by using virtualenv and providing access to external data sources.
It's no secret that peopledon't read their terms and conditions agreements. Rather than spending hours reading through dense legal document, a vast majority of people will simply click agree and move on with their day. That's why we built Your Terms, a text classifier that

### Exeriments

In the Notebooks module you can view all of the different experiments we ran.

### Demo
To run the demo:
Move into the app directory with ```cd app```
Run the app with ```flask run```
This should run the flask app locally on your computer, so you should be able to use the demo at http://127.0.0.1:5000 (the port number may differ depending on your computer)

Move into the app directory with by using ```cd app``` in your command line
To run the app use ```flask run```
This should run the flask app locally on your computer, so you should be able to use the demo in your web browser at http://127.0.0.1:5000 (the port number may differ depending on your computer)
Press ```ctrl + C``` in your command line to shut down the demo

### Contents

- [docs](docs): template to create slides for project presentations
- [nlp](nlp): Python project code
- [notebooks](notebooks): Jupyter notebooks for project development and experimentation
- [report](report): LaTeX report
- [tests](tests): unit tests for project code


3 changes: 2 additions & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ def forward(self, attention_mask = None, token_type_ids = None,input_ids = None)
# model.load_state_dict(torch.load(MODEL_PATH))
# model.eval()
# tokenizer = BertTokenizer.from_pretrained('distilbert/distilbert-base-uncased')
tokenizer = None
stemmer = PorterStemmer()
bow_model = joblib.load('../models/logistic_regression_bow.pkl')
bow_model = joblib.load('../demo-model/logistic_regression_bow.pkl')
nltk.download('stopwords')
nltk.download('punkt')
stop_words = set(stopwords.words('english'))
Expand Down
Binary file added demo-model/logistic_regression_bow.pkl
Binary file not shown.
Binary file added figures/bow_confusion_matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d3d959c

Please sign in to comment.