Handle missing results
This commit is contained in:
parent
8e6a67f31b
commit
257ea7a397
1 changed files with 2 additions and 0 deletions
2
app.py
2
app.py
|
@ -36,6 +36,8 @@ def complete(q: str):
|
|||
data = pd.read_sql(query, con, params=terms)
|
||||
results = data.apply(lambda row: f'{row.title} — {row.url}', axis=1)
|
||||
print("Results", results)
|
||||
if len(results) == 0:
|
||||
return []
|
||||
return [q, results.to_list()[:5]]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue