Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,7 @@ def extract_text_markdown(doc):
|
|
68 |
|
69 |
@spaces.GPU
|
70 |
def convert(pdf_file):
|
|
|
71 |
doc = fitz.open(pdf_file)
|
72 |
markdown_output = ""
|
73 |
image_counter = 1
|
@@ -100,11 +101,15 @@ def convert(pdf_file):
|
|
100 |
|
101 |
markdown_output += "\n---\n\n"
|
102 |
|
103 |
-
return markdown_output.strip(), {}
|
104 |
|
105 |
gr.Interface(
|
106 |
fn=convert,
|
107 |
inputs=[gr.File(label="Sube tu PDF", type="filepath")],
|
108 |
-
outputs=[
|
|
|
|
|
|
|
|
|
109 |
).launch()
|
110 |
|
|
|
68 |
|
69 |
@spaces.GPU
|
70 |
def convert(pdf_file):
|
71 |
+
image_paths.append(image_path)
|
72 |
doc = fitz.open(pdf_file)
|
73 |
markdown_output = ""
|
74 |
image_counter = 1
|
|
|
101 |
|
102 |
markdown_output += "\n---\n\n"
|
103 |
|
104 |
+
return markdown_output.strip(), {}, image_paths
|
105 |
|
106 |
gr.Interface(
|
107 |
fn=convert,
|
108 |
inputs=[gr.File(label="Sube tu PDF", type="filepath")],
|
109 |
+
outputs=[
|
110 |
+
gr.Text(label="Markdown estructurado"),
|
111 |
+
gr.JSON(label="Metadata"),
|
112 |
+
gr.Gallery(label="Imágenes extraídas").style(grid=[2], height="auto")
|
113 |
+
],
|
114 |
).launch()
|
115 |
|