File size: 1,439 Bytes
e5c84cb fbbb10b e5c84cb a9433ca 65699fa a9433ca 65699fa a9433ca e5c84cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
---
emoji: π
title: π€ BERT + ELMo Sentence Similarity Analyzer
---
# π€ BERT + ELMo Sentence Similarity Analyzer
This Gradio app allows you to compute semantic similarity between sentences using **BERT** and **ELMo** embeddings. Users can add sentences, select a BERT variant, and see pairwise similarity matrices.
---
## π Features
- Supports multiple BERT variants:
- **BERT Large Uncased** (1024 dims, recommended for similarity)
- **BERT Large Cased** (1024 dims, preserves capitalization)
- **BERT Base Uncased** (768 dims, faster)
- **BERT Base Cased** (768 dims)
- **ELMo embeddings** (1024 dims, context-aware)
- Mean-pooling over tokens for BERT
- Pairwise cosine similarity using PyTorch & Scikit-learn
- Clear and reset stored sentences anytime
- Easy-to-use Gradio interface with live status updates
---
## π How to Use
1. **Choose Model**: Select your preferred BERT variant (uncased recommended for semantic similarity).
2. **Add Sentences**: Type a sentence and click **Add Sentence**.
3. **Repeat**: Add at least 2 sentences to compute similarity.
4. **Compute Similarity**: Click **Compute Similarity** to generate pairwise similarity matrices.
5. **Clear All**: Reset all stored sentences and embeddings.
> Values closer to `1.0` indicate higher semantic similarity.
---
## π§° Requirements
Install dependencies from `requirements.txt`:
```bash
pip install -r requirements.txt |