Code Monkey home page Code Monkey logo

precily_api's Introduction

Text Similarity API

This Flask API calculates the similarity between two text sentences using the Sentence Transformers library. It utilizes pre-trained models to convert text into embeddings and computes the cosine similarity between them.

Prerequisites

  • Python 3.x
  • Flask
  • Sentence Transformers

Install the required Python packages using the following command:

pip install flask sentence-transformers

Usage

  1. Clone this repository to your local machine.

  2. Open a terminal and navigate to the project directory.

  3. Run the Flask API using the following command:

    python app.py

    This will start the API locally on http://localhost:8080.

  4. Use a tool like curl or Postman to send POST requests to the API with JSON data containing two text sentences for which you want to calculate similarity. Example:

    curl -X POST -H "Content-Type: application/json" -d '{"text1": "First sentence", "text2": "Second sentence"}' http://localhost:8080
  5. The API will respond with a JSON object containing the similarity score between the two sentences.

Endpoint

  • POST /

    • Request:

      {
        "text1": "First sentence",
        "text2": "Second sentence"
      }
    • Response:

      {
        "similarity score": 0.85
      }

precily_api's People

Contributors

skaty5678 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.