Spaces:
Sleeping
Sleeping
fix some comment formatting
Browse files
app.py
CHANGED
|
@@ -36,7 +36,7 @@ def create_embeddings(text_chunks): # Convert text chunks to vector embeddings
|
|
| 36 |
|
| 37 |
chunk_embeddings = create_embeddings(cleaned_chunks)
|
| 38 |
|
| 39 |
-
#STEP 5 FROM SEMANTIC SEARCH
|
| 40 |
def get_top_chunks(query, chunk_embeddings, text_chunks): # Return top 3 text chunks most semantically similar to the query
|
| 41 |
query_embedding = model.encode(query,convert_to_tensor=True)
|
| 42 |
|
|
@@ -57,7 +57,7 @@ def get_top_chunks(query, chunk_embeddings, text_chunks): # Return top 3 text ch
|
|
| 57 |
|
| 58 |
return top_chunks
|
| 59 |
|
| 60 |
-
#STEP 6 FROM SEMANTIC SEARCH
|
| 61 |
top_results = get_top_chunks(
|
| 62 |
"Why is it important to carry copies of your travel documents?",
|
| 63 |
chunk_embeddings,
|
|
@@ -66,7 +66,8 @@ top_results = get_top_chunks(
|
|
| 66 |
|
| 67 |
print(top_results)
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
client = InferenceClient("Qwen/Qwen2.5-72B-instruct")
|
| 71 |
|
| 72 |
def respond(message, history): # Generate a response using the most relevant travel info chunks
|
|
|
|
| 36 |
|
| 37 |
chunk_embeddings = create_embeddings(cleaned_chunks)
|
| 38 |
|
| 39 |
+
# STEP 5 FROM SEMANTIC SEARCH
|
| 40 |
def get_top_chunks(query, chunk_embeddings, text_chunks): # Return top 3 text chunks most semantically similar to the query
|
| 41 |
query_embedding = model.encode(query,convert_to_tensor=True)
|
| 42 |
|
|
|
|
| 57 |
|
| 58 |
return top_chunks
|
| 59 |
|
| 60 |
+
# STEP 6 FROM SEMANTIC SEARCH
|
| 61 |
top_results = get_top_chunks(
|
| 62 |
"Why is it important to carry copies of your travel documents?",
|
| 63 |
chunk_embeddings,
|
|
|
|
| 66 |
|
| 67 |
print(top_results)
|
| 68 |
|
| 69 |
+
|
| 70 |
+
# HUGGING FACE PROJECT
|
| 71 |
client = InferenceClient("Qwen/Qwen2.5-72B-instruct")
|
| 72 |
|
| 73 |
def respond(message, history): # Generate a response using the most relevant travel info chunks
|