Skip to main content
100%

Gist 5cb8bf884b466e5a35b2c9d12489454b

✓ Published0🌍 Public
HHirosaji
Last edited Feb 24, 2020
Created on Feb 24, 2020

This example shows a web service that computes sentence similarity, returning a JSON payload with the target sentence, compared texts, and their cosine similarity scores. The user submits a POST request to the `/sim` endpoint containing a target and list of texts. The application, built with Flask, uses the BERT model to extract `[CLS]` token features from each sentence, then calculates cosine similarity between the target and each comparison. The code explicitly uses `get_futures` for feature extraction and `calc_simlarity` for the similarity computation, all orchestrated through Flask's routing and `jsonify` for the response.

AI-generated description

Similar vizzes