Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
import time
|
| 4 |
from langchain_community.document_loaders import UnstructuredFileLoader # Updated import
|
| 5 |
-
import spaces
|
| 6 |
|
| 7 |
def extract_text_with_langchain_pdf(pdf_file):
|
| 8 |
"""Extract text from a PDF using LangChain's UnstructuredFileLoader."""
|
|
@@ -63,7 +62,6 @@ with gr.Blocks() as demo:
|
|
| 63 |
output_text = gr.Textbox(label="Extracted Text", lines=20, interactive=False)
|
| 64 |
download_button = gr.File(label="Download Extracted CSV")
|
| 65 |
|
| 66 |
-
@spaces.GPU
|
| 67 |
def on_extract(pdf_file, batch_size, wait_time):
|
| 68 |
"""Callback function to extract text, display batches, and save CSV."""
|
| 69 |
df, batch_output = process_pdf_with_batches(pdf_file, int(batch_size), wait_time)
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import time
|
| 4 |
from langchain_community.document_loaders import UnstructuredFileLoader # Updated import
|
|
|
|
| 5 |
|
| 6 |
def extract_text_with_langchain_pdf(pdf_file):
|
| 7 |
"""Extract text from a PDF using LangChain's UnstructuredFileLoader."""
|
|
|
|
| 62 |
output_text = gr.Textbox(label="Extracted Text", lines=20, interactive=False)
|
| 63 |
download_button = gr.File(label="Download Extracted CSV")
|
| 64 |
|
|
|
|
| 65 |
def on_extract(pdf_file, batch_size, wait_time):
|
| 66 |
"""Callback function to extract text, display batches, and save CSV."""
|
| 67 |
df, batch_output = process_pdf_with_batches(pdf_file, int(batch_size), wait_time)
|