rearrange query_model and def get_pinterest_link
Browse files
app.py
CHANGED
@@ -83,28 +83,10 @@ def generate_response(user_query, relevant_segment):
|
|
83 |
print(f"Error in generating response: {e}")
|
84 |
return f"Error in generating response: {e}"
|
85 |
|
86 |
-
def query_model(question):
|
87 |
-
"""
|
88 |
-
Process a question, find relevant information, and generate a response.
|
89 |
-
"""
|
90 |
-
|
91 |
-
if question == "":
|
92 |
-
return "Welcome to Designare! Ask me anything about different styles or inspiration for interior design."
|
93 |
-
|
94 |
-
relevant_segment = find_relevant_segment(question, segments)
|
95 |
-
if not relevant_segment:
|
96 |
-
return "Could not find specific information. Please refine your question."
|
97 |
-
|
98 |
-
response = generate_response(question, relevant_segment)
|
99 |
-
return response
|
100 |
-
|
101 |
def get_pinterest_link(question):
|
102 |
"""
|
103 |
Check if the question contains a keyword and return the corresponding Pinterest link.
|
104 |
"""
|
105 |
-
def get_pinterest_link(question): """
|
106 |
-
Check if the question contains a keyword and return the corresponding Pinterest link.
|
107 |
-
"""
|
108 |
keyword_links = {
|
109 |
"contemporary": "Here is a link to the pinterest board to help you get started and find inspiration for your style! Just copy this link to get to the board: https://pin.it/1KcrPFm8G",
|
110 |
"eclectic": "Here is a link to the pinterest board to help you get started and find inspiration for your style! Just copy this link to get to the board: https://pin.it/67iavfUmS",
|
@@ -131,7 +113,27 @@ def get_pinterest_link(question):
|
|
131 |
if keyword in question.lower():
|
132 |
return link
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
# Define the welcome message and specific topics the chatbot can provide information about
|
136 |
welcome_message = """
|
137 |
# 🛋️ Welcome to Designare!
|
|
|
83 |
print(f"Error in generating response: {e}")
|
84 |
return f"Error in generating response: {e}"
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
def get_pinterest_link(question):
|
87 |
"""
|
88 |
Check if the question contains a keyword and return the corresponding Pinterest link.
|
89 |
"""
|
|
|
|
|
|
|
90 |
keyword_links = {
|
91 |
"contemporary": "Here is a link to the pinterest board to help you get started and find inspiration for your style! Just copy this link to get to the board: https://pin.it/1KcrPFm8G",
|
92 |
"eclectic": "Here is a link to the pinterest board to help you get started and find inspiration for your style! Just copy this link to get to the board: https://pin.it/67iavfUmS",
|
|
|
113 |
if keyword in question.lower():
|
114 |
return link
|
115 |
|
116 |
+
|
117 |
+
def query_model(question):
|
118 |
+
"""
|
119 |
+
Process a question, find relevant information, and generate a response.
|
120 |
+
"""
|
121 |
+
|
122 |
+
pinterest_link = get_pinterest_link(question)
|
123 |
+
if pinterest_link:
|
124 |
+
return f"Here is a link to the Pinterest board to help you get started and find inspiration for your style! Just copy this link to get to the board: {pinterest_link}"
|
125 |
+
|
126 |
+
if question == "":
|
127 |
+
return "Welcome to Designare! Ask me anything about different styles or inspiration for interior design."
|
128 |
|
129 |
+
relevant_segment = find_relevant_segment(question, segments)
|
130 |
+
if not relevant_segment:
|
131 |
+
return "Could not find specific information. Please refine your question."
|
132 |
+
|
133 |
+
response = generate_response(question, relevant_segment)
|
134 |
+
return response
|
135 |
+
|
136 |
+
|
137 |
# Define the welcome message and specific topics the chatbot can provide information about
|
138 |
welcome_message = """
|
139 |
# 🛋️ Welcome to Designare!
|