mobinln commited on
Commit
192ba4d
1 Parent(s): c06afa2

fix: make temp dir if not exist

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import streamlit as st
2
  from llm import load_llm, response_generator
3
  from vector_store import load_vector_store, process_pdf
@@ -55,6 +56,9 @@ with st.sidebar:
55
  if uploaded_files is not None:
56
  vector_store = load_vector_store()
57
  for uploaded_file in uploaded_files:
 
 
 
58
  temp_file = f"./temp/{uploaded_file.name}-{uuid4()}.pdf"
59
  with open(temp_file, "wb") as file:
60
  file.write(uploaded_file.getvalue())
 
1
+ import os
2
  import streamlit as st
3
  from llm import load_llm, response_generator
4
  from vector_store import load_vector_store, process_pdf
 
56
  if uploaded_files is not None:
57
  vector_store = load_vector_store()
58
  for uploaded_file in uploaded_files:
59
+ temp_dir = "./temp"
60
+ if not os.path.exists(temp_dir):
61
+ os.makedirs(temp_dir)
62
  temp_file = f"./temp/{uploaded_file.name}-{uuid4()}.pdf"
63
  with open(temp_file, "wb") as file:
64
  file.write(uploaded_file.getvalue())