This project provides a web interface for classifying sections of Privacy Policies and Terms of Service documents using a fine-tuned BERT model. It consists of a FastAPI backend for model inference and a Streamlit frontend for user interaction.
A Streamlit-based web interface that allows users to:
- Input sections of privacy policies or terms of service
- Submit text for classification
- View classification results with confidence scores
- Visualize predictions through interactive bar charts
A FastAPI server that:
- Loads a custom fine-tuned BERT model for multi-label classification
- Processes incoming text requests
- Returns predicted categories with confidence scores
- Handles model inference using PyTorch
- Install the required packages:
pip install -r requirements.txt- Start the backend server:
uvicorn backend_fastapi:app --reload- Launch the frontend:
streamlit run frontend_streamlit.py- Open the Streamlit interface in your browser (typically http://localhost:8501)
- Paste a section of privacy policy or terms of service into the text area
- Click "Classify Section" to analyze the text
- View the results, including:
- Detected privacy categories
- Confidence scores
- Visual representation of all category probabilities
The system uses the Hacktrix-121/bert-base-uncased-opp115-multilabel model, which is trained on the OPP-115 Privacy Policy Dataset to identify 12 different privacy policy categories:
- First Party Collection/Use
- Third Party Sharing/Collection
- User Choice/Control
- User Access, Edit & Deletion
- Data Retention
- Data Security
- Policy Change
- Do Not Track
- International & Specific Audiences
- Miscellaneous and Other
- Contact Information
- User Choices/Consent Mechanisms
The model is fine-tuned on BERT base uncased for multi-label classification of privacy policy segments. The OPP-115 dataset consists of 115 privacy policies (267K words) annotated by skilled annotators for various privacy practice categories.
- Python 3.7+
- FastAPI for the backend server
- Streamlit for the web interface
- PyTorch and Transformers for model inference
- See
requirements.txtfor complete dependencies