bibin765's picture
Update app.py
e5d2ecf
Raw History Blame Contribute Delete
710 Bytes
import gradio as gr
import camelot
import pandas as pd
def extract_tables(pdf_file):
# Extract tables from the uploaded PDF
tables = camelot.read_pdf(pdf_file, pages="all", backend = "poppler")
# Combine tables into a single DataFrame
combined_df = pd.concat([table.df for table in tables])
# Save the combined DataFrame to a CSV file
# csv_data = combined_df.to_csv(index=False)
return "Hello"
iface = gr.Interface(
fn=extract_tables,
inputs=gr.components.File(),
outputs=gr.components.Text(),
title="PDF to CSV Extractor",
description="Upload a PDF file, and it will extract tables and display them as CSV.",
theme="default"
)
iface.launch()