noorulamean444 commited on
Commit
4562763
1 Parent(s): ae3db05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -8,6 +8,7 @@ from utils import package_installer
8
 
9
  package_installer('sentence_transformers')
10
  package_installer('nbconvert')
 
11
  # package_installer('nbformat')
12
  # package_installer('beautifulsoup4')
13
 
@@ -15,6 +16,9 @@ from sentence_transformers import SentenceTransformer, util
15
  import nbconvert
16
  import nbformat
17
  from bs4 import BeautifulSoup
 
 
 
18
 
19
  def convert_ipynb_to_html(input_file):
20
  # Load .ipynb file into a nbformat.NotebookNode object
@@ -85,7 +89,7 @@ def chat(message,history):
85
  indexed_cells_list = []
86
  for i in range(len(cells_list_copy)):
87
  itxt = cells_list_copy[i]
88
- indexed_cells_list.append(f'# Cell Number: {i+1}\n' + itxt)
89
 
90
 
91
  # cells = re.split(r"In\xa0\[[0-9\xa0]*\]:",text)
 
8
 
9
  package_installer('sentence_transformers')
10
  package_installer('nbconvert')
11
+ package_installer('inflect')
12
  # package_installer('nbformat')
13
  # package_installer('beautifulsoup4')
14
 
 
16
  import nbconvert
17
  import nbformat
18
  from bs4 import BeautifulSoup
19
+ from inflect import engine
20
+
21
+ inflect_engine = engine()
22
 
23
  def convert_ipynb_to_html(input_file):
24
  # Load .ipynb file into a nbformat.NotebookNode object
 
89
  indexed_cells_list = []
90
  for i in range(len(cells_list_copy)):
91
  itxt = cells_list_copy[i]
92
+ indexed_cells_list.append(f'# Cell Number: {i+1}\n' + f'# Cell Number: {inflect_engine.number_to_words(i+1)}\n' + itxt)
93
 
94
 
95
  # cells = re.split(r"In\xa0\[[0-9\xa0]*\]:",text)