Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,9 @@ import gradio as gr
|
|
| 2 |
import pdfplumber
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
-
def extract_data(
|
| 6 |
# Load PDF and extract specific rows
|
| 7 |
-
with pdfplumber.open(
|
| 8 |
-
# Code to extract the specified range from Position 10 to Position 450 goes here
|
| 9 |
data = []
|
| 10 |
for page in pdf.pages:
|
| 11 |
text = page.extract_text()
|
|
@@ -33,7 +32,7 @@ def extract_data(pdf_file, start_pos, end_pos):
|
|
| 33 |
interface = gr.Interface(
|
| 34 |
fn=extract_data,
|
| 35 |
inputs=[
|
| 36 |
-
gr.File(type="
|
| 37 |
gr.Number(value=10, label="Start Position"),
|
| 38 |
gr.Number(value=450, label="End Position")
|
| 39 |
],
|
|
@@ -41,3 +40,4 @@ interface = gr.Interface(
|
|
| 41 |
)
|
| 42 |
|
| 43 |
interface.launch()
|
|
|
|
|
|
| 2 |
import pdfplumber
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
+
def extract_data(pdf_file_path, start_pos, end_pos):
|
| 6 |
# Load PDF and extract specific rows
|
| 7 |
+
with pdfplumber.open(pdf_file_path) as pdf:
|
|
|
|
| 8 |
data = []
|
| 9 |
for page in pdf.pages:
|
| 10 |
text = page.extract_text()
|
|
|
|
| 32 |
interface = gr.Interface(
|
| 33 |
fn=extract_data,
|
| 34 |
inputs=[
|
| 35 |
+
gr.File(type="filepath", label="Upload PDF File"),
|
| 36 |
gr.Number(value=10, label="Start Position"),
|
| 37 |
gr.Number(value=450, label="End Position")
|
| 38 |
],
|
|
|
|
| 40 |
)
|
| 41 |
|
| 42 |
interface.launch()
|
| 43 |
+
|