Spaces:
Sleeping
Sleeping
File size: 573 Bytes
3469319 8b139bf d97cfeb f6ae938 3469319 359e981 3469319 ea64bb3 3469319 8b139bf 3469319 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import camelot
import pandas as pd
import gradio as gr
def extract_tables(pdf_file):
tables = camelot.read_pdf(pdf_file.name, pages="all")
df = pd.concat([table.df for table in tables], ignore_index=True)
df.to_excel("output.xlsx", index=False)
return "output.xlsx"
interface = gr.Interface(
fn=extract_tables,
inputs=gr.File(label="Upload PDF"),
outputs=gr.File(label="Download Excel"),
title="PDF Table Extractor",
description="Extract tables from PDF and output as Excel file.",
)
if __name__ == "__main__":
interface.launch()
|