Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • frank/wakefield-movie-recommender
1 result
Show changes
Commits on Source (3)
FROM python:3.10
RUN useradd -m app
WORKDIR /home/app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY app.py qgram.py /home/app/
COPY examples/titles.json /home/app/examples/
RUN chown -R root:app /home/app
RUN chmod -R u=rX,g=rX,o=- /home/app
USER app:app
ENTRYPOINT ["gunicorn", "-w", "4", "-b", "0.0.0.0", "app:app"]
TAG=0.1.0
build:
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build -t gitlab.sauerburger.com:5049/frank/wakefield-movie-recommender:$(TAG) .
push: build
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker push gitlab.sauerburger.com:5049/frank/wakefield-movie-recommender:$(TAG)
......@@ -9,7 +9,7 @@ import qgram
app = Flask(__name__)
with open("examples/titles.json") as fileobj:
with open("examples/titles.json", encoding="utf-8") as fileobj:
titles = json.load(fileobj)
index = qgram.QGramIndex()
......@@ -18,12 +18,13 @@ for title, _ in titles.values():
@app.route("/")
def suggest():
"""Serve movie title suggestions"""
query = request.args.get("q")
if not query:
return {}
results = []
if query:
results = index.search(query)
results = index.search(query)
return {
"suggestions": results[:100]
}
flask~=2.1.2
gunicorn~=20.1.0