Nice / pages /111_📚_PDF简单表格提取.py
betterme
update
b966bc9
raw
history blame
964 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : Python.
# @File : 111_📚_PDF简单表格提取
# @Time : 2022/11/3 下午6:09
# @Author : yuanjie
# @WeChat : meutils
# @Software : PyCharm
# @Description :
from appzoo.streamlit_app import Page
import streamlit as st
from st_aggrid import AgGrid
import camelot
class MyPage(Page):
def main(self):
with st.form("Coding"):
file = st.file_uploader("选择待上传的PDF文件", type=['pdf', 'docx', 'xlsx'])
if file:
open(file.name, 'wb').write(file.read())
if st.form_submit_button('开始转换'):
tables = camelot.read_pdf(file.name)
df = tables[0].df
print(df)
st.dataframe(df)
if __name__ == '__main__':
app_title = "# 切词"
app_info = ""
MyPage(app_title=app_title, app_info=app_info, layout='wide').main()