Update app.py
Browse files
app.py
CHANGED
|
@@ -22,12 +22,12 @@ def search_books(ques, max_givenbooks = 5):
|
|
| 22 |
)
|
| 23 |
matched_books = books[text_be].head(max_givenbooks)
|
| 24 |
if matched_books.empty:
|
| 25 |
-
return "No exact matches found in the catalog for this description"
|
| 26 |
-
|
| 27 |
for idx, row in matched_books.iterrows():
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
return
|
| 31 |
def respond(message, history):
|
| 32 |
catalog_info = search_books(message)
|
| 33 |
|
|
|
|
| 22 |
)
|
| 23 |
matched_books = books[text_be].head(max_givenbooks)
|
| 24 |
if matched_books.empty:
|
| 25 |
+
return "No exact matches found in the catalog for this description."
|
| 26 |
+
results_str = "Available books in our catalog matching your request:\n"
|
| 27 |
for idx, row in matched_books.iterrows():
|
| 28 |
+
results_str += f" - **Title** : {row['Title']} | **Author** : {row['Author']} | **Genre** : {row['Genre']} | **Age** : {row['Age_Range']}/n"
|
| 29 |
+
results_str += f" *Description* : {row['Description']}\n\n"
|
| 30 |
+
return results_str
|
| 31 |
def respond(message, history):
|
| 32 |
catalog_info = search_books(message)
|
| 33 |
|