elia-waefler commited on
Commit
54ce67f
·
1 Parent(s): 656b153
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -9,6 +9,7 @@ import my_new_openai
9
  import time
10
  import streamlit as st
11
  import os
 
12
 
13
 
14
  def merge_indices(index1, index2):
@@ -147,8 +148,11 @@ def main():
147
  else:
148
  st.warning("unsaved embeddings will be lost.")
149
  else:
 
 
 
 
150
  file = st.file_uploader("upload file", accept_multiple_files=False)
151
- vec_store = setup_db.load_vectorstore_from_excel("data/KBOB_Klassifizierung.xlsx")
152
  if st.button("classify me!"):
153
  with st.spinner("Classifying..."):
154
  query_vecs = []
@@ -158,13 +162,13 @@ def main():
158
  with one:
159
  st.success("text")
160
  # ONE OR MULTIPLE IS THE QUESTION
161
- imgs = ingest.get_pdf_images(file.getvalue())
162
- if type(imgs) != list:
163
- imgs = [imgs]
164
- for img in imgs:
165
  text += my_new_openai.img_to_text(img_base64=my_new_openai.image_bytes_to_base64(img))
166
  with two:
167
- st.success("imgs")
168
 
169
  tabs = ingest.get_pdf_tables(file.getvalue())
170
 
 
9
  import time
10
  import streamlit as st
11
  import os
12
+ from PIL import Image
13
 
14
 
15
  def merge_indices(index1, index2):
 
148
  else:
149
  st.warning("unsaved embeddings will be lost.")
150
  else:
151
+ if not sst.vectorstore:
152
+ vec_store = setup_db.load_vectorstore_from_excel("data/KBOB_Klassifizierung.xlsx")
153
+ sst.vectorstore = True
154
+ sst.page = "home"
155
  file = st.file_uploader("upload file", accept_multiple_files=False)
 
156
  if st.button("classify me!"):
157
  with st.spinner("Classifying..."):
158
  query_vecs = []
 
162
  with one:
163
  st.success("text")
164
  # ONE OR MULTIPLE IS THE QUESTION
165
+ images = ingest.get_pdf_images(file.getvalue())
166
+ if type(images) != list:
167
+ images = [images]
168
+ for img in images:
169
  text += my_new_openai.img_to_text(img_base64=my_new_openai.image_bytes_to_base64(img))
170
  with two:
171
+ st.success("images")
172
 
173
  tabs = ingest.get_pdf_tables(file.getvalue())
174