bhagatsuryainatom commited on
Commit
49fc714
1 Parent(s): e1bd857

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -36,13 +36,15 @@ def pdf_to_text(file):
36
  page_text = image_to_latex(image)
37
  page_text = clean_text(page_text)
38
  if len(page_text.split()) > 5:
39
- page_text = "## Metadata: Page Number " + str(i+1) + "\n" + page_text
 
40
  full_text += page_text + "\n\n"
41
  base_name = os.path.splitext(os.path.basename(file.name))[0]
42
  output_file_name = base_name + ".txt"
43
  with open(output_file_name, 'w') as f:
44
  f.write(full_text)
45
- return output_file_name
 
46
 
47
 
48
  iface = gr.Interface(fn=pdf_to_text,
 
36
  page_text = image_to_latex(image)
37
  page_text = clean_text(page_text)
38
  if len(page_text.split()) > 5:
39
+ page_number = i + 1
40
+ page_text = "## Metadata: Page Number " + str(page_number) + "\n" + page_text
41
  full_text += page_text + "\n\n"
42
  base_name = os.path.splitext(os.path.basename(file.name))[0]
43
  output_file_name = base_name + ".txt"
44
  with open(output_file_name, 'w') as f:
45
  f.write(full_text)
46
+ return output_file_name, page_number
47
+
48
 
49
 
50
  iface = gr.Interface(fn=pdf_to_text,