Chris4K commited on
Commit
fc7a81d
1 Parent(s): 1c0d6df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -100,9 +100,11 @@ def calculate_statistics(embeddings):
100
  return {"tokens": len(embeddings), "time_taken": time.time()}
101
 
102
  def upload_file(file, model_name, split_strategy, chunk_size, overlap_size, max_tokens, query, top_k):
 
 
103
  # Write the file using file.read() instead of file.value
104
  with open(os.path.join(FILES_DIR, file.name), "wb") as f:
105
- f.write(file.read()) # Use .read() to get the file content
106
 
107
  # Process files and get embeddings
108
  embeddings, chunks = process_files(model_name, split_strategy, chunk_size, overlap_size, max_tokens)
 
100
  return {"tokens": len(embeddings), "time_taken": time.time()}
101
 
102
  def upload_file(file, model_name, split_strategy, chunk_size, overlap_size, max_tokens, query, top_k):
103
+ fh = open(file, 'r')
104
+ data = fh.readlines()
105
  # Write the file using file.read() instead of file.value
106
  with open(os.path.join(FILES_DIR, file.name), "wb") as f:
107
+ f.write(data) # Use .read() to get the file content
108
 
109
  # Process files and get embeddings
110
  embeddings, chunks = process_files(model_name, split_strategy, chunk_size, overlap_size, max_tokens)