https://github.com/sudothearkknight/similarstatementgenerator
This is a fast python API that will take any one statement as an input and will generate a similar version of the statement purely based on the vector values,
https://github.com/sudothearkknight/similarstatementgenerator
Last synced: 5 months ago
JSON representation
This is a fast python API that will take any one statement as an input and will generate a similar version of the statement purely based on the vector values,
- Host: GitHub
- URL: https://github.com/sudothearkknight/similarstatementgenerator
- Owner: sudoTheArkKnight
- License: gpl-3.0
- Created: 2024-12-09T08:03:28.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-09T08:18:13.000Z (6 months ago)
- Last Synced: 2024-12-09T09:30:09.742Z (6 months ago)
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Similar Statement Generator
This project is a web application that finds similar statements to a given input statement using FastAPI and a pre-trained SentenceTransformer model.
## Features
- Accepts a user input statement via a web form.
- Uses a pre-trained SentenceTransformer model to find similar statements.
- Displays the top 10 most similar statements.## Requirements
- Python 3.7+
- FastAPI
- Uvicorn
- SentenceTransformer
- scikit-learn
- numpy## Installation
1. Clone the repository:
```sh
git clone https://github.com/sudoTheArkKnight/SimilarStatementGenerator.git
cd SimilarStatementGenerator
```2. Create a virtual environment and activate it:
```sh
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```3. Install the required packages:
```sh
pip install -r requirements.txt
```## Running the Application
1. Start the FastAPI server:
```sh
uvicorn main:app --host 127.0.0.1 --port 8000
```2. Open your web browser and navigate to:
```
http://127.0.0.1:8000/static/index.html
```## Project Structure
- `main.py`: The main FastAPI application file.
- `static/index.html`: The HTML file for the web interface.
- `requirements.txt`: The list of required Python packages.
- `.gitignore`: Git ignore file to exclude certain files and directories.## API Endpoints
- `POST /similar_statements/`: Accepts a JSON payload with a `statement` field and returns the top 10 most similar statements.
## Example
To test the API, you can use the following HTTP request:
```http
POST http://127.0.0.1:8000/similar_statements/
Content-Type: application/json{
"statement": "Good evening"
}