Chris4K commited on
Commit
187e575
1 Parent(s): cc3959e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -273,7 +273,9 @@ def search_embeddings(chunks, embedding_model, vector_store_type, search_type, q
273
  def calculate_statistics(results, search_time, vector_store, num_tokens, embedding_model, query, top_k):
274
  stats = {
275
  "num_results": len(results),
276
- "avg_content_length": np.mean([len(doc.page_content) for doc in results]) if not results.empty else 0,
 
 
277
  "search_time": search_time,
278
  "vector_store_size": vector_store._index.ntotal if hasattr(vector_store, '_index') else "N/A",
279
  "num_documents": len(vector_store.docstore._dict),
 
273
  def calculate_statistics(results, search_time, vector_store, num_tokens, embedding_model, query, top_k):
274
  stats = {
275
  "num_results": len(results),
276
+ "avg_content_length": sum(len(doc.page_content) for doc in results) / len(results) if results else 0,
277
+
278
+ # "avg_content_length": np.mean([len(doc.page_content) for doc in results]) if not results.empty else 0,
279
  "search_time": search_time,
280
  "vector_store_size": vector_store._index.ntotal if hasattr(vector_store, '_index') else "N/A",
281
  "num_documents": len(vector_store.docstore._dict),