Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,22 @@ def query_model(question):
|
|
| 98 |
response = generate_response(question, relevant_segment)
|
| 99 |
return response
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
# Define the welcome message and specific topics the chatbot can provide information about
|
|
@@ -130,39 +145,7 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
|
| 130 |
answer = gr.Textbox(label="Tessy Response", placeholder="Tessy will respond here...", interactive=False, lines=10)
|
| 131 |
submit_button = gr.Button("Submit")
|
| 132 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
def get_pinterest_link(question):
|
| 136 |
-
"""
|
| 137 |
-
Check if the question contains a keyword and return the corresponding Pinterest link.
|
| 138 |
-
"""
|
| 139 |
-
|
| 140 |
-
keyword_links = {
|
| 141 |
-
"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",
|
| 142 |
-
"ecletic": "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",
|
| 143 |
-
"modern": "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/5XriVnahy",
|
| 144 |
-
"traditional": "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/6DnKcLMWC",
|
| 145 |
-
"asian": "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/7fA3Z8Lw2",
|
| 146 |
-
"beach": "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/3yXAwLdM4",
|
| 147 |
-
"craftsman": "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/4sKpBEgFA",
|
| 148 |
-
"farmhouse": "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/3QHeclkAk",
|
| 149 |
-
"industrial": "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/58tp64jEx",
|
| 150 |
-
"mediterranean": "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/6ikPHFnOo",
|
| 151 |
-
"minimalistic": "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/3cSZwa8Nw",
|
| 152 |
-
"mid-century": "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/30b5Mz1xa",
|
| 153 |
-
"rustic": "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/5eyZ4xSEP",
|
| 154 |
-
"scandinavian": "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/6Dw4px7XZ",
|
| 155 |
-
"shabby-chic": "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/4AZ0MpD0q",
|
| 156 |
-
"southwestern": "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/7nmK5dcae",
|
| 157 |
-
"transitional": "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/7hy7YMVWv",
|
| 158 |
-
"tropical": "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/41HtSEew0",
|
| 159 |
-
"victorian": "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/3UrJ3mDXm",
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
for keyword, link in keyword_links.items():
|
| 163 |
-
if keyword in question.lower():
|
| 164 |
-
return link
|
| 165 |
-
|
| 166 |
|
| 167 |
# Launch the Gradio app to allow user interaction
|
| 168 |
demo.launch(share=True)
|
|
|
|
| 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 |
+
keyword_links = {
|
| 106 |
+
"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",
|
| 107 |
+
"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",
|
| 108 |
+
"modern": "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/5XriVnahy",
|
| 109 |
+
"traditional": "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/6DnKcLMWC",
|
| 110 |
+
"asian": "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/7fA3Z8Lw2",
|
| 111 |
+
"beach": "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/3yXAwLdM4",
|
| 112 |
+
"craftsman": "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/4sKpBEgFA",
|
| 113 |
+
"farmhouse": "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/3QHeclkAk",
|
| 114 |
+
"industrial": "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/58tp64jEx",
|
| 115 |
+
"mediterranean": "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/6ikPHFnOo",
|
| 116 |
+
"minimalistic": "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/3cSZwa8N
|
| 117 |
|
| 118 |
|
| 119 |
# Define the welcome message and specific topics the chatbot can provide information about
|
|
|
|
| 145 |
answer = gr.Textbox(label="Tessy Response", placeholder="Tessy will respond here...", interactive=False, lines=10)
|
| 146 |
submit_button = gr.Button("Submit")
|
| 147 |
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
| 148 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
# Launch the Gradio app to allow user interaction
|
| 151 |
demo.launch(share=True)
|