Spaces:
Runtime error
Runtime error
Download app.py from bibin765/pdf_table_extractor: direct link, hf CLI and curl.
- Browser
- Download file 710 Bytes
-
https://huggingface.co/spaces/bibin765/pdf_table_extractor/resolve/main/app.py
- Command line
-
hf download hf://spaces/bibin765/pdf_table_extractor/app.py
-
curl -L -o app.py https://huggingface.co/spaces/bibin765/pdf_table_extractor/resolve/main/app.py
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() | |