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.') # 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) create_vectorstore_and_store() st.text("Vektordatenbank erstellt!") generate_files()