Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def use_marker(pdf_filepath):
|
|
| 23 |
config = MarkdownExtractorConfig(batch_multiplier=2)
|
| 24 |
|
| 25 |
result = markdown_extractor.extract(content, config)
|
| 26 |
-
return result
|
| 27 |
|
| 28 |
@spaces.GPU
|
| 29 |
def use_pdf_extractor(pdf_filepath):
|
|
@@ -37,9 +37,8 @@ def use_pdf_extractor(pdf_filepath):
|
|
| 37 |
config = PDFExtractorConfig(output_types=["text", "table"])
|
| 38 |
|
| 39 |
result = pdf_extractor.extract(content, config)
|
| 40 |
-
return result
|
| 41 |
|
| 42 |
-
@spaces.GPU
|
| 43 |
def use_gemini(pdf_filepath, key):
|
| 44 |
if pdf_filepath is None:
|
| 45 |
raise gr.Error("Please provide some input PDF: upload an PDF file")
|
|
@@ -51,9 +50,8 @@ def use_gemini(pdf_filepath, key):
|
|
| 51 |
config = GeminiExtractorConfig(prompt="Extract all text from the document.", model_name="gemini-1.5-flash", key=key)
|
| 52 |
|
| 53 |
result = gemini_extractor.extract(content, config)
|
| 54 |
-
return result
|
| 55 |
|
| 56 |
-
@spaces.GPU
|
| 57 |
def use_openai(pdf_filepath, key):
|
| 58 |
if pdf_filepath is None:
|
| 59 |
raise gr.Error("Please provide some input PDF: upload an PDF file")
|
|
@@ -65,7 +63,7 @@ def use_openai(pdf_filepath, key):
|
|
| 65 |
config = OAIExtractorConfig(prompt="Extract all text from the document.", model_name="gpt-4o", key=key)
|
| 66 |
|
| 67 |
result = oai_extractor.extract(content, config)
|
| 68 |
-
return result
|
| 69 |
|
| 70 |
with gr.Blocks(title="PDF data extraction with Marker & Indexify") as marker_demo:
|
| 71 |
gr.HTML("<h1 style='text-align: center'>PDF data extraction with Marker & <a href='https://getindexify.ai/'>Indexify</a></h1>")
|
|
|
|
| 23 |
config = MarkdownExtractorConfig(batch_multiplier=2)
|
| 24 |
|
| 25 |
result = markdown_extractor.extract(content, config)
|
| 26 |
+
return str(result)
|
| 27 |
|
| 28 |
@spaces.GPU
|
| 29 |
def use_pdf_extractor(pdf_filepath):
|
|
|
|
| 37 |
config = PDFExtractorConfig(output_types=["text", "table"])
|
| 38 |
|
| 39 |
result = pdf_extractor.extract(content, config)
|
| 40 |
+
return str(result)
|
| 41 |
|
|
|
|
| 42 |
def use_gemini(pdf_filepath, key):
|
| 43 |
if pdf_filepath is None:
|
| 44 |
raise gr.Error("Please provide some input PDF: upload an PDF file")
|
|
|
|
| 50 |
config = GeminiExtractorConfig(prompt="Extract all text from the document.", model_name="gemini-1.5-flash", key=key)
|
| 51 |
|
| 52 |
result = gemini_extractor.extract(content, config)
|
| 53 |
+
return str(result)
|
| 54 |
|
|
|
|
| 55 |
def use_openai(pdf_filepath, key):
|
| 56 |
if pdf_filepath is None:
|
| 57 |
raise gr.Error("Please provide some input PDF: upload an PDF file")
|
|
|
|
| 63 |
config = OAIExtractorConfig(prompt="Extract all text from the document.", model_name="gpt-4o", key=key)
|
| 64 |
|
| 65 |
result = oai_extractor.extract(content, config)
|
| 66 |
+
return str(result)
|
| 67 |
|
| 68 |
with gr.Blocks(title="PDF data extraction with Marker & Indexify") as marker_demo:
|
| 69 |
gr.HTML("<h1 style='text-align: center'>PDF data extraction with Marker & <a href='https://getindexify.ai/'>Indexify</a></h1>")
|