Spaces:
Runtime error
Runtime error
Update appStore/multiapp.py
Browse files- appStore/multiapp.py +16 -2
appStore/multiapp.py
CHANGED
@@ -31,7 +31,7 @@ class MultiApp:
|
|
31 |
|
32 |
def run(self):
|
33 |
if 'file' not in st.session_state:
|
34 |
-
st.session_state['
|
35 |
|
36 |
st.sidebar.write(format_func=lambda app: app['title'])
|
37 |
image = Image.open('appStore/img/sdsn.png')
|
@@ -44,4 +44,18 @@ class MultiApp:
|
|
44 |
st.sidebar.markdown('')
|
45 |
st.sidebar.markdown("## ๐ Upload document ")
|
46 |
file = st.sidebar.file_uploader('', type=['pdf', 'docx', 'txt']) #Upload PDF File
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
def run(self):
|
33 |
if 'file' not in st.session_state:
|
34 |
+
st.session_state['pipeline'] = None
|
35 |
|
36 |
st.sidebar.write(format_func=lambda app: app['title'])
|
37 |
image = Image.open('appStore/img/sdsn.png')
|
|
|
44 |
st.sidebar.markdown('')
|
45 |
st.sidebar.markdown("## ๐ Upload document ")
|
46 |
file = st.sidebar.file_uploader('', type=['pdf', 'docx', 'txt']) #Upload PDF File
|
47 |
+
|
48 |
+
if file is not None:
|
49 |
+
with tempfile.NamedTemporaryFile(mode="wb") as temp:
|
50 |
+
bytes_data = file.getvalue()
|
51 |
+
temp.write(bytes_data)
|
52 |
+
file_name = file.name
|
53 |
+
file_path = temp.name
|
54 |
+
|
55 |
+
st.write("Filename: ", file.name)
|
56 |
+
|
57 |
+
# load document
|
58 |
+
documents = pre.load_document(temp.name,file_name)
|
59 |
+
documents_processed = pre.preprocessing(documents)
|
60 |
+
pipeline = start_haystack(documents_processed)
|
61 |
+
st.session_state['pipeline'] = pipeline
|