This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from gensim.models import word2vec | |
| import logging | |
| logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) | |
| model1 = word2vec.Word2Vec.load_word2vec_format('models/glove_model.txt', binary=False) | |
| model1.init_sims(replace=True) | |
| from flask import Flask, jsonify, request | |
| app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scala.concurrent.{ExecutionContext, Future} | |
| import spray.routing.{AuthenticationFailedRejection, RequestContext} | |
| import spray.routing.authentication.{Authentication, ContextAuthenticator} | |
| /** Token based authentication for Spray Routing. | |
| * | |
| * Extracts an API key from the header or querystring and authenticates requests. | |
| * | |
| * TokenAuthenticator[T] takes arguments for the named header/query string containing the API key and | |
| * an authenticator that returns an Option[T]. If None is returned from the authenticator, the request |