vermen commited on
Commit
ecb502f
·
verified ·
1 Parent(s): c10dd1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -12,12 +12,6 @@ def load_txt(file_name):
12
  text = file.read()
13
  return text
14
  ####
15
- # Download and extract Poppler (Linux version)
16
- os.system("wget -q https://github.com/ishappylife/poppler-utils/releases/download/v0.90.1/poppler-utils-ubuntu.tar.gz -O poppler.tar.gz")
17
- os.system("tar -xzf poppler.tar.gz -C /usr/local/")
18
-
19
- # Set PATH to use Poppler
20
- os.environ["PATH"] += os.pathsep + "/usr/local/poppler-utils/bin"
21
  #os.system("apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-latex-extra")
22
  #os.system("apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-recommended texlive-pictures texlive-science texlive-latex-extra poppler-utils")
23
  #print("all latex installed")
@@ -109,16 +103,16 @@ def generate_pdf_png(latex_code):
109
  pdf_file = "latex_code.pdf"
110
  print("already have a pdf")
111
  # save as pdf
112
- from pdf2image import convert_from_path
113
- images = convert_from_path(pdf_file)
114
- image = images[0]
115
- image.save("latex_code.png")
116
- print("Image saved as latex_code.png")
117
 
118
  def generate_results(file_path):
119
  tikcd_code = generate_tex(file_path) # filepath of the image, as input for the generative model
120
  generate_pdf_png(tikcd_code)
121
- return ("./latex_code.png",extract_document_content(tikcd_code))
122
  #
123
  print("all was initialized\n")
124
  #write_txt("aux.tex","Hello world")
 
12
  text = file.read()
13
  return text
14
  ####
 
 
 
 
 
 
15
  #os.system("apt-get install -y texlive-latex-base texlive-fonts-recommended texlive-latex-extra")
16
  #os.system("apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-recommended texlive-pictures texlive-science texlive-latex-extra poppler-utils")
17
  #print("all latex installed")
 
103
  pdf_file = "latex_code.pdf"
104
  print("already have a pdf")
105
  # save as pdf
106
+ #from pdf2image import convert_from_path
107
+ #images = convert_from_path(pdf_file)
108
+ #image = images[0]
109
+ #image.save("latex_code.png")
110
+ #print("Image saved as latex_code.png")
111
 
112
  def generate_results(file_path):
113
  tikcd_code = generate_tex(file_path) # filepath of the image, as input for the generative model
114
  generate_pdf_png(tikcd_code)
115
+ return ("./latex_code.pdf",extract_document_content(tikcd_code))
116
  #
117
  print("all was initialized\n")
118
  #write_txt("aux.tex","Hello world")