Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ for sent in context.split("."):
|
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
-
corpus_embeddings = np.load('
|
| 53 |
|
| 54 |
|
| 55 |
|
|
@@ -57,25 +57,11 @@ def find_sentences(query):
|
|
| 57 |
query_embedding = model.encode(query)
|
| 58 |
hits = util.semantic_search(query_embedding, corpus_embeddings, top_k=1)
|
| 59 |
hit = hits[0][0]
|
| 60 |
-
message(hit)
|
| 61 |
corpus_id = hit['corpus_id']
|
| 62 |
-
message(corpus_id)
|
| 63 |
saved = corpus[corpus_id]
|
| 64 |
-
message(saved)
|
| 65 |
-
# Find source document based on sentence index
|
| 66 |
-
count = 0
|
| 67 |
-
for idx, c in enumerate(sentence_count):
|
| 68 |
-
count+=c
|
| 69 |
-
if (corpus_id > count-1):
|
| 70 |
-
continue
|
| 71 |
-
else:
|
| 72 |
-
doc = corpus[idx]
|
| 73 |
-
return doc
|
| 74 |
return saved
|
| 75 |
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
message_history = [{"text":"Let's find out the best task for your use case! Tell me about your use case :)", "is_user":False}]
|
| 80 |
|
| 81 |
st.subheader("If you don't know how to build your machine learning product for your use case, Taskmaster is here to help you! 🪄✨")
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
+
corpus_embeddings = np.load('task_embeddings_updated_msmarco-distilbert-base-v4.npy')
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 57 |
query_embedding = model.encode(query)
|
| 58 |
hits = util.semantic_search(query_embedding, corpus_embeddings, top_k=1)
|
| 59 |
hit = hits[0][0]
|
|
|
|
| 60 |
corpus_id = hit['corpus_id']
|
|
|
|
| 61 |
saved = corpus[corpus_id]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
return saved
|
| 63 |
|
| 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 |
|
| 67 |
st.subheader("If you don't know how to build your machine learning product for your use case, Taskmaster is here to help you! 🪄✨")
|