Liam Dyer commited on
Commit
145d936
·
unverified ·
1 Parent(s): 99e6147
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +31 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,4 +1,4 @@
1
  ---
2
  license: gpl-3.0
3
- title: Pdf To Markdown
4
  ---
 
1
  ---
2
  license: gpl-3.0
3
+ title: PDF to Markdown
4
  ---
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import os
3
+
4
+ from marker.convert import convert_single_pdf
5
+ from marker.logger import configure_logging
6
+ from marker.models import load_all_models
7
+
8
+ import spaces
9
+ import gradio as gr
10
+ from marker.output import save_markdown
11
+
12
+
13
+ @spaces.GPU
14
+ def convert(file_path):
15
+ model_lst = load_all_models()
16
+ full_text, images, out_meta = convert_single_pdf(
17
+ file_path,
18
+ model_lst,
19
+ max_pages=None,
20
+ langs=None,
21
+ batch_multiplier=16,
22
+ )
23
+
24
+ return full_text
25
+
26
+
27
+ gr.Interface(
28
+ convert,
29
+ inputs=gr.File(label="PDF file", sources=["upload"], type="filepath"),
30
+ outputs=gr.Markdown(label="Markdown"),
31
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ marker-pdf=0.2.5