Carlos Salgado commited on
Commit
485711d
·
1 Parent(s): b5a892f

try to fix upload bug

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -26,9 +26,11 @@ st.write('## Generate metadata?')
26
  uploaded_file = st.file_uploader("Choose a PDF file", type=["pdf","txt"])
27
 
28
  if uploaded_file is not None:
29
- with tempfile.NamedTemporaryFile(delete=False, suffix=os.path.splitext(uploaded_file.name)[1]) as tmp:
 
 
30
  tmp.write(uploaded_file.read())
31
- file_path = tmp.name
32
  st.write(f'Created temporary file {file_path}')
33
 
34
  docs = ingest(file_path)
 
26
  uploaded_file = st.file_uploader("Choose a PDF file", type=["pdf","txt"])
27
 
28
  if uploaded_file is not None:
29
+ extension = uploaded_file.name.split('.')[-1]
30
+
31
+ with tempfile.NamedTemporaryFile(delete=False) as tmp:
32
  tmp.write(uploaded_file.read())
33
+ file_path = f'{tmp.name}.{extension}'
34
  st.write(f'Created temporary file {file_path}')
35
 
36
  docs = ingest(file_path)