binqiangliu commited on
Commit
c52b691
·
1 Parent(s): 351c7d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -46,14 +46,16 @@ if "directory_path" not in st.session_state:
46
  st.session_state.directory_path = generate_random_string(20)
47
 
48
  with st.sidebar:
49
- st.subheader("Upload your Documents Here: ")
 
50
  if "pdf_files" not in st.session_state:
51
- st.session_state.pdf_files = st.file_uploader("Choose your PDF Files and Press OK", type=['pdf'], accept_multiple_files=True)
 
52
  if not st.session_state.pdf_files: #如果没有上传文件,则程序停止执行,就不会出现documents为空的错误情况、
53
  st.warning("请上传文档文件")
54
  st.stop()
55
  else: #如果已经上传文件,则装载文件SimpleDirectoryReader.load_data()
56
- st.session_state.pdf_files=pdf_files
57
  if not os.path.exists(st.session_state.directory_path):
58
  os.makedirs(st.session_state.directory_path)
59
  for pdf_file in st.session_state.pdf_files:
 
46
  st.session_state.directory_path = generate_random_string(20)
47
 
48
  with st.sidebar:
49
+ st.subheader("Upload your Documents Here: ")
50
+ pdf_files = st.file_uploader("Choose your PDF Files and Press OK", type=['pdf'], accept_multiple_files=True)
51
  if "pdf_files" not in st.session_state:
52
+ #st.session_state.pdf_files = st.file_uploader("Choose your PDF Files and Press OK", type=['pdf'], accept_multiple_files=True)
53
+ st.session_state.pdf_files = pdf_files
54
  if not st.session_state.pdf_files: #如果没有上传文件,则程序停止执行,就不会出现documents为空的错误情况、
55
  st.warning("请上传文档文件")
56
  st.stop()
57
  else: #如果已经上传文件,则装载文件SimpleDirectoryReader.load_data()
58
+ #st.session_state.pdf_files=pdf_files
59
  if not os.path.exists(st.session_state.directory_path):
60
  os.makedirs(st.session_state.directory_path)
61
  for pdf_file in st.session_state.pdf_files: