Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,21 +58,21 @@ def find_sentences(query):
|
|
| 58 |
saved = corpus[corpus_id]
|
| 59 |
return saved
|
| 60 |
|
| 61 |
-
|
| 62 |
-
message_history = [{"text":"Let's find out the best task for your use case! Tell me about your use case :)", "is_user":False}]
|
| 63 |
-
|
| 64 |
st.subheader("If you don't know how to build your machine learning product for your use case, Taskmaster is here to help you! πͺβ¨")
|
| 65 |
-
st.write("Hint: Try to ask your use case in a question form.")
|
| 66 |
-
for msg in message_history:
|
| 67 |
-
message(msg["text"], is_user = msg["is_user"]) # display all the previous message
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
|
| 72 |
input = st.text_input("Ask me π€")
|
| 73 |
if input:
|
|
|
|
| 74 |
|
| 75 |
-
message_history.append({"text":input, "is_user" : True})
|
| 76 |
|
| 77 |
model_answer = find_sentences(input)
|
| 78 |
|
|
@@ -84,17 +84,14 @@ if input:
|
|
| 84 |
response_templates = [f"I think that {key} is the best task for this π€© Check out the page ππΌ {url}", f"I think you should use {key} πͺ Check it out here ππΌ {url}", f"I think {key} should work for you π€ Check out the page ππΌ {url}"]
|
| 85 |
|
| 86 |
bot_answer = random.choice(response_templates)
|
| 87 |
-
|
|
|
|
| 88 |
if key_exists == False:
|
| 89 |
fallback_template = ["I didn't get the question π§ Could you please ask again? Try 'What should I use for detecting masks in an image?'",
|
| 90 |
"Hmm, not sure I know the answer, maybe you could ask differently? π€",
|
| 91 |
"Sorry, I didn't understand you, maybe you could ask differently? π€ Try asking 'What should I use to extract name in a document' π€"]
|
| 92 |
bot_answer = random.choice(fallback_template)
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
if last_message:
|
| 98 |
-
message(last_message["text"], last_message["is_user"])
|
| 99 |
-
|
| 100 |
-
|
|
|
|
| 58 |
saved = corpus[corpus_id]
|
| 59 |
return saved
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
st.subheader("If you don't know how to build your machine learning product for your use case, Taskmaster is here to help you! πͺβ¨")
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
message("Let's find out the best task for your use case! Tell me about your use case :)")
|
| 64 |
+
|
| 65 |
+
#message_history = [{"text":"Let's find out the best task for your use case! Tell me about your use case :)", "is_user":False}]
|
| 66 |
+
#for msg in message_history:
|
| 67 |
+
# message(msg["text"], is_user = msg["is_user"])
|
| 68 |
+
#placeholder = st.empty() # placeholder for latest message
|
| 69 |
|
| 70 |
|
| 71 |
input = st.text_input("Ask me π€")
|
| 72 |
if input:
|
| 73 |
+
message(input, is_user = True)
|
| 74 |
|
| 75 |
+
#message_history.append({"text":input, "is_user" : True})
|
| 76 |
|
| 77 |
model_answer = find_sentences(input)
|
| 78 |
|
|
|
|
| 84 |
response_templates = [f"I think that {key} is the best task for this π€© Check out the page ππΌ {url}", f"I think you should use {key} πͺ Check it out here ππΌ {url}", f"I think {key} should work for you π€ Check out the page ππΌ {url}"]
|
| 85 |
|
| 86 |
bot_answer = random.choice(response_templates)
|
| 87 |
+
message(bot_answer)
|
| 88 |
+
#message_history.append({"text":bot_answer, "is_user" : False})
|
| 89 |
if key_exists == False:
|
| 90 |
fallback_template = ["I didn't get the question π§ Could you please ask again? Try 'What should I use for detecting masks in an image?'",
|
| 91 |
"Hmm, not sure I know the answer, maybe you could ask differently? π€",
|
| 92 |
"Sorry, I didn't understand you, maybe you could ask differently? π€ Try asking 'What should I use to extract name in a document' π€"]
|
| 93 |
bot_answer = random.choice(fallback_template)
|
| 94 |
+
message(bot_answer)
|
| 95 |
+
#message_history.append({"text":bot_answer, "is_user" : False})
|
| 96 |
+
|
| 97 |
+
|
|
|
|
|
|
|
|
|
|
|
|