tea-phan-y
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -62,7 +62,7 @@ def find_relevant_segment(user_query, segments):
|
|
62 |
print(f"Error in finding relevant segment: {e}")
|
63 |
return ""
|
64 |
|
65 |
-
def generate_response(user_query,
|
66 |
"""
|
67 |
Generate a response emphasizing the bot's capability in providing literature information.
|
68 |
"""
|
@@ -100,7 +100,7 @@ def query_model(question, book):
|
|
100 |
"""
|
101 |
if question == "":
|
102 |
return "Welcome to LitBot! Ask me anything about literature, book themes, and the historical context behind your book."
|
103 |
-
relevant_segment = find_relevant_segment(question, segments)
|
104 |
if not relevant_segment:
|
105 |
return "Could not find specific information. Please refine your question."
|
106 |
response = generate_response(question, relevant_segment)
|
|
|
62 |
print(f"Error in finding relevant segment: {e}")
|
63 |
return ""
|
64 |
|
65 |
+
def generate_response(user_query, relevant_segment):
|
66 |
"""
|
67 |
Generate a response emphasizing the bot's capability in providing literature information.
|
68 |
"""
|
|
|
100 |
"""
|
101 |
if question == "":
|
102 |
return "Welcome to LitBot! Ask me anything about literature, book themes, and the historical context behind your book."
|
103 |
+
relevant_segment = find_relevant_segment(question and book, segments)
|
104 |
if not relevant_segment:
|
105 |
return "Could not find specific information. Please refine your question."
|
106 |
response = generate_response(question, relevant_segment)
|