pszemraj commited on
Commit
db092ad
β€’
1 Parent(s): 85b5da3

Signed-off-by: peter szemraj <peterszemraj@gmail.com>

Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -55,7 +55,11 @@ def load_uploaded_file(file_obj, temp_dir: Path = None):
55
  return None
56
 
57
 
58
- def convert_PDF(pdf_obj, language: str = "en", max_pages=20,):
 
 
 
 
59
  """
60
  convert_PDF - convert a PDF file to text
61
 
@@ -125,7 +129,9 @@ if __name__ == "__main__":
125
  with demo:
126
 
127
  gr.Markdown("# PDF to Text")
128
- gr.Markdown("A basic demo of pdf-to-text conversion using OCR from the [doctr](https://mindee.github.io/doctr/index.html) package")
 
 
129
  gr.Markdown("---")
130
 
131
  with gr.Column():
@@ -134,13 +140,12 @@ if __name__ == "__main__":
134
  gr.Markdown("Upload your own file & replace the default")
135
  gr.Markdown("_If no file is uploaded, a sample PDF will be used_")
136
 
137
-
138
  uploaded_file = gr.File(
139
- label="Upload a PDF file",
140
- file_count="single",
141
- type="file",
142
- value= _here / "example_file.pdf",
143
- )
144
 
145
  gr.Markdown("---")
146
 
@@ -160,6 +165,8 @@ if __name__ == "__main__":
160
  )
161
 
162
  convert_button.click(
163
- fn=convert_PDF, inputs=[uploaded_file], outputs=[OCR_text, out_placeholder, text_file]
 
 
164
  )
165
  demo.launch(enable_queue=True)
 
55
  return None
56
 
57
 
58
+ def convert_PDF(
59
+ pdf_obj,
60
+ language: str = "en",
61
+ max_pages=20,
62
+ ):
63
  """
64
  convert_PDF - convert a PDF file to text
65
 
 
129
  with demo:
130
 
131
  gr.Markdown("# PDF to Text")
132
+ gr.Markdown(
133
+ "A basic demo of pdf-to-text conversion using OCR from the [doctr](https://mindee.github.io/doctr/index.html) package"
134
+ )
135
  gr.Markdown("---")
136
 
137
  with gr.Column():
 
140
  gr.Markdown("Upload your own file & replace the default")
141
  gr.Markdown("_If no file is uploaded, a sample PDF will be used_")
142
 
 
143
  uploaded_file = gr.File(
144
+ label="Upload a PDF file",
145
+ file_count="single",
146
+ type="file",
147
+ value=_here / "example_file.pdf",
148
+ )
149
 
150
  gr.Markdown("---")
151
 
 
165
  )
166
 
167
  convert_button.click(
168
+ fn=convert_PDF,
169
+ inputs=[uploaded_file],
170
+ outputs=[OCR_text, out_placeholder, text_file],
171
  )
172
  demo.launch(enable_queue=True)