mahynski commited on
Commit
b965179
·
1 Parent(s): 3ae3597

column test

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -101,6 +101,7 @@ with st.sidebar:
101
  accept_multiple_files=False
102
  )
103
 
 
104
  if uploaded_file is not None:
105
  # Parse the file
106
  parser = LlamaParse(
@@ -110,20 +111,27 @@ with st.sidebar:
110
 
111
  # Create a temporary directory to save the file then load and parse it
112
  temp_dir = tempfile.TemporaryDirectory()
113
- filename = os.path.join(temp_dir.name, uploaded_file.name)
114
- with open(filename, "wb") as f:
115
  f.write(uploaded_file.getvalue())
116
- parsed_document = parser.load_data(filename)
117
  temp_dir.cleanup()
118
 
119
  col1, col2 = st.columns(2)
120
 
121
  with col1:
122
- st.write(uploaded_file)
123
- st.write(parsed_document)
124
 
125
  with col2:
126
- if uploaded_file is not None:
127
- # Display the pdf
128
- bytes_data = uploaded_file.getvalue()
129
- pdf_viewer(input=bytes_data, width=700)
 
 
 
 
 
 
 
 
 
101
  accept_multiple_files=False
102
  )
103
 
104
+ parsed_document = None
105
  if uploaded_file is not None:
106
  # Parse the file
107
  parser = LlamaParse(
 
111
 
112
  # Create a temporary directory to save the file then load and parse it
113
  temp_dir = tempfile.TemporaryDirectory()
114
+ temp_filename = os.path.join(temp_dir.name, uploaded_file.name)
115
+ with open(temp_filename, "wb") as f:
116
  f.write(uploaded_file.getvalue())
117
+ parsed_document = parser.load_data(temp_filename)
118
  temp_dir.cleanup()
119
 
120
  col1, col2 = st.columns(2)
121
 
122
  with col1:
123
+ pass
 
124
 
125
  with col2:
126
+ tab1, tab2 = st.tabs(["Uploaded File", "Parsed File",])
127
+
128
+ with tab1:
129
+ st.header('This is the raw file you uploaded.')
130
+ if uploaded_file is not None: # Display the pdf
131
+ bytes_data = uploaded_file.getvalue()
132
+ pdf_viewer(input=bytes_data, width=700)
133
+
134
+ with tab2:
135
+ st.header('This is the parsed version of the file.')
136
+ if parsed_document is not None: # Showed the raw parsing result
137
+ st.write(parsed_document)