albertmartinez's picture
Upgrade gradio
3ce1088
metadata
title: Sentence Transformers
emoji: 🏢
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 5.33.1
app_file: app.py
pinned: false

Sentence Transformers Demo

Interactive web application for semantic text similarity analysis using Sentence Transformers models.

Features

1. Paraphrase Mining

  • Find sentences with similar meaning in a text corpus
  • Support for multiple language models
  • Adjustable similarity threshold
  • Export results in CSV format

2. Semantic Textual Similarity (STS)

  • Calculate semantic similarity between two sets of sentences
  • Uses advanced sentence transformation models
  • Compare sentences in different languages
  • Export results in CSV format

Available Models

Requirements

  • Python 3.8+
  • Dependencies listed in requirements.txt

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/sentence-transformers.git
cd sentence-transformers
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
.\venv\Scripts\activate  # Windows
  1. Install dependencies:
pip install -r requirements.txt

Usage

  1. Start the application:
python app.py
  1. Open your browser at http://localhost:7860

  2. Select the desired functionality:

    • Paraphrase Mining: Upload a CSV file with sentences to analyze
    • STS: Upload two CSV files with sentences to compare
  3. Select the model and adjust the similarity threshold

  4. Click "Process" to start the analysis

  5. Download results in CSV format

CSV File Format

CSV files must contain a column named "text" with the sentences to analyze:

text
"First sentence to analyze"
"Second sentence to analyze"
...

Notes

  • Temporary files are automatically cleaned up every 30 minutes
  • Using complete sentences is recommended for better results
  • Models may take time to load on first use

License

MIT

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference