Created
June 8, 2021 23:20
-
-
Save generall/bcf440219e37f579d693328f6f17040a to your computer and use it in GitHub Desktop.
This file contains 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
# File: service.py | |
from fastapi import FastAPI | |
# That is the file where NeuralSearcher is stored | |
from neural_searcher import NeuralSearcher | |
app = FastAPI() | |
# Create an instance of the neural searcher | |
neural_searcher = NeuralSearcher(collection_name='startups') | |
@app.get("/api/search") | |
def search_startup(q: str): | |
return { | |
"result": neural_searcher.search(text=q) | |
} | |
if __name__ == "__main__": | |
import uvicorn | |
uvicorn.run(app, host="0.0.0.0", port=8000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment