Spaces:
Runtime error
Runtime error
Update app.py
Browse files17 unmodified lines1819202122232417 unmodified lineschunks = load_knowledge()chunk_embeddings = embedding_model.encode(chunks, convert_to_numpy=True)def get_relevant_context(query, top_k=3):query_embedding = embedding_model.encode([query], convert_to_numpy=True)scores = np.dot(chunk_embeddings, query_embedding.T).flatten()top_indices = np.argsort(scores)[::-1][:top_k]17 unmodified lines1819202122232417 unmodified lineschunks = load_knowledge()chunk_embeddings = embedding_model.encode(chunks, convert_to_numpy=True)def get_relevant_context(query, top_k=5):query_embedding = embedding_model.encode([query], convert_to_numpy=True)scores = np.dot(chunk_embeddings, query_embedding.T).flatten()top_indices = np.argsort(scores)[::-1][:top_k]
app.py+1-1