From 6be574a0feea9f4187974c9da2923713e112d5e9 Mon Sep 17 00:00:00 2001 From: Andrej Karpathy Date: Tue, 7 Dec 2021 22:56:09 -0800 Subject: [PATCH] hah don't crash if a user submits an invalid query, better to return empty results. in the future we may want a helpful error message too --- serve.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/serve.py b/serve.py index 3bad8c4..5ec22df 100644 --- a/serve.py +++ b/serve.py @@ -118,7 +118,8 @@ def svm_rank(tags: str = '', pid: str = '', svm_c: str = ''): # tag can be one tag or a few comma-separated tags or 'all' for all tags we have in db # pid can be a specific paper id to set as positive for a kind of nearest neighbor search - assert tags or pid + if not (tags or pid): + return [], [] # load all of the features features = load_features()