daniel-wojahn commited on
Commit
2a3547c
·
1 Parent(s): d841ec8

naming error fix

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ venv
__pycache__/theme.cpython-310.pyc ADDED
Binary file (6.97 kB). View file
 
app.py CHANGED
@@ -282,17 +282,17 @@ Each segment is represented as a vector of these TF-IDF scores, and the cosine s
282
  chapter_name_inputs = []
283
  for file in files:
284
  try:
285
- content = Path(file.name).read_text(encoding="utf-8-sig")
286
- segments = content.split('༈')
 
287
  num_chapters = len(segments)
288
- file_data[Path(file.name).name] = {'path': file.name, 'chapters': num_chapters}
289
 
290
  for i in range(num_chapters):
291
- default_name = f"{Path(file.name).name} - Chapter {i + 1}"
292
- chapter_name_inputs.append(gr.Textbox(label=f"Name for Chapter {i+1} in '{Path(file.name).name}'", value=default_name))
293
  except Exception as e:
294
  logger.error(f"Error processing file {file.name} for chapter renaming: {e}")
295
- # Handle file read error gracefully
296
  pass
297
 
298
  if not chapter_name_inputs:
@@ -593,4 +593,4 @@ Each segment is represented as a vector of these TF-IDF scores, and the cosine s
593
 
594
  if __name__ == "__main__":
595
  demo = main_interface()
596
- demo.launch()
 
282
  chapter_name_inputs = []
283
  for file in files:
284
  try:
285
+ file_path = Path(file.name)
286
+ content = file_path.read_text(encoding="utf-8-sig")
287
+ segments = [seg for seg in content.split('༈') if seg.strip()]
288
  num_chapters = len(segments)
289
+ file_data[file_path.name] = {'path': file.name, 'chapters': num_chapters}
290
 
291
  for i in range(num_chapters):
292
+ default_name = f"{file_path.name} - Chapter {i + 1}"
293
+ chapter_name_inputs.append(gr.Textbox(label=f"Name for Chapter {i+1} in '{file_path.name}'", value=default_name))
294
  except Exception as e:
295
  logger.error(f"Error processing file {file.name} for chapter renaming: {e}")
 
296
  pass
297
 
298
  if not chapter_name_inputs:
 
593
 
594
  if __name__ == "__main__":
595
  demo = main_interface()
596
+ demo.launch(share=True)
pipeline/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (163 Bytes). View file
 
pipeline/__pycache__/fasttext_embedding.cpython-310.pyc ADDED
Binary file (15.2 kB). View file
 
pipeline/__pycache__/hf_embedding.cpython-310.pyc ADDED
Binary file (2.83 kB). View file
 
pipeline/__pycache__/llm_service.cpython-310.pyc ADDED
Binary file (17.4 kB). View file
 
pipeline/__pycache__/metrics.cpython-310.pyc ADDED
Binary file (8.75 kB). View file
 
pipeline/__pycache__/process.cpython-310.pyc ADDED
Binary file (11.1 kB). View file
 
pipeline/__pycache__/stopwords_bo.cpython-310.pyc ADDED
Binary file (4.04 kB). View file
 
pipeline/__pycache__/stopwords_lite_bo.cpython-310.pyc ADDED
Binary file (1.41 kB). View file
 
pipeline/__pycache__/tokenize.cpython-310.pyc ADDED
Binary file (4.13 kB). View file
 
pipeline/__pycache__/visualize.cpython-310.pyc ADDED
Binary file (4.4 kB). View file