File size: 991 Bytes
ff1f92b 3441551 92b9cf0 ff1f92b 1dfd295 ff1f92b 4f46c08 e301b1e ff1f92b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import streamlit as st
from pathlib import Path
from pages.table import generate_files
from pages.bot import create_vectorstore_and_store
#from bot.py import *
st.markdown("# Dokumentenupload")
st.sidebar.markdown("# Dokumentenupload")
UPLOAD_FOLDER = './files' # Ordner für Dateiablage
def save_file(uploaded_file):
save_folder = UPLOAD_FOLDER
save_path = Path(save_folder, uploaded_file.name)
with open(save_path, mode = 'wb') as w:
w.write(uploaded_file.getvalue())
if save_path.exists():
st.success(f'Dokument {uploaded_file.name} wurde erfolgreich auf den Server hochgeladen.')
create_vectorstore_and_store()
st.text("Vektordatenbank erstellt!")
# file uploader
with st.form('upload_form'):
uploaded_file = st.file_uploader("Wählen Sie eine Datei aus.", type = [ ".pdf"])
submit = st.form_submit_button(label='Hochladen')
if uploaded_file:
filename = uploaded_file.name
save_file(uploaded_file)
generate_files()
|