Chris4K commited on
Commit
f5be605
·
verified ·
1 Parent(s): 9177f24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -100,7 +100,7 @@ def calculate_statistics(embeddings):
100
  return {"tokens": len(embeddings), "time_taken": time.time()}
101
 
102
  import shutil
103
- def upload_file(file, model_name, split_strategy, chunk_size=100, overlap_size=0, max_tokens=100, query="Who is Christof", top_k=2):
104
  # Create the full destination file path
105
  #file_path = os.path.join(FILES_DIR, file.name)
106
 
@@ -109,6 +109,12 @@ def upload_file(file, model_name, split_strategy, chunk_size=100, overlap_size=0
109
  # f.write(file.read()) # Read and write the file content
110
 
111
  # Process files and get embeddings
 
 
 
 
 
 
112
  embeddings, chunks = process_files(model_name, split_strategy, chunk_size, overlap_size, max_tokens)
113
 
114
  # Perform search
 
100
  return {"tokens": len(embeddings), "time_taken": time.time()}
101
 
102
  import shutil
103
+ def upload_file(file, model_name, split_strategy, chunk_size, overlap_size, max_tokens, query, top_k):
104
  # Create the full destination file path
105
  #file_path = os.path.join(FILES_DIR, file.name)
106
 
 
109
  # f.write(file.read()) # Read and write the file content
110
 
111
  # Process files and get embeddings
112
+
113
+ if overlap_size is None:
114
+ overlap_size = 0 # Set a default overlap size
115
+ if chunk_size is None:
116
+ chunk_size = 200 # Set a default chunk size
117
+
118
  embeddings, chunks = process_files(model_name, split_strategy, chunk_size, overlap_size, max_tokens)
119
 
120
  # Perform search