import streamlit as st
from PIL import Image
import io,os
import numpy as np 
import pandas as pd
from pdf2image import convert_from_path 
from datetime import datetime
   
# 设置文心一言图片分辨率最大4000
RESOLUTION = 4000
dpi = 200

  


def get_current_datetime():
    # 获取当前时间  
    now = datetime.now()  
    # 格式化时间字符串  
    formatted_time = now.strftime("%Y%m%d%H:%M:%S") 
    return formatted_time



def main():
    # 定义一个文件上传的组件  
    uploaded_file = st.file_uploader('文件',type=['pdf']) 
    image_path_list =  []
    # 判空  
    if uploaded_file is not None:
        print(uploaded_file)
        exit()
        file_type = uploaded_file.name.split('.')[-1]
        if file_type == 'pdf':
            pass
        else:
            st.text('File type not supported. Please upload a Word (.docx) or Excel (.xlsx) file.')
    else:
        st.text('Please upload a file.')
    
    st.subheader('结果输出:')
    df = pd.DataFrame(
        np.random.randn(50, 20),
        columns=('col %d' % i for i in range(20)))
    st.dataframe(df)        
    
    if len(image_path_list) > 0:
        # 请求百度API接口
        pass
        
if __name__ == "__main__":
    main()





