Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def load_vector_store(file_path, store_name, force_reload=False):
|
|
| 63 |
if not force_reload and os.path.exists(vector_store_path):
|
| 64 |
with open(vector_store_path, "rb") as f:
|
| 65 |
VectorStore = pickle.load(f)
|
| 66 |
-
st.text(f"Loaded existing vector store from {vector_store_path}")
|
| 67 |
else:
|
| 68 |
# Load and process the PDF, then create the vector store
|
| 69 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200, length_function=len)
|
|
@@ -75,7 +75,7 @@ def load_vector_store(file_path, store_name, force_reload=False):
|
|
| 75 |
# Serialize the vector store
|
| 76 |
with open(vector_store_path, "wb") as f:
|
| 77 |
pickle.dump(VectorStore, f)
|
| 78 |
-
st.text(f"Created and saved vector store at {vector_store_path}")
|
| 79 |
|
| 80 |
# Change working directory for Git operations
|
| 81 |
original_dir = os.getcwd()
|
|
@@ -83,14 +83,14 @@ def load_vector_store(file_path, store_name, force_reload=False):
|
|
| 83 |
|
| 84 |
try:
|
| 85 |
# Check current working directory and list files for debugging
|
| 86 |
-
st.text(f"Current working directory: {os.getcwd()}")
|
| 87 |
-
st.text(f"Files in current directory: {os.listdir()}")
|
| 88 |
|
| 89 |
# Adjusted file path for Git command
|
| 90 |
repo.git_add(f"{store_name}.pkl") # Use just the file name
|
| 91 |
repo.git_commit(f"Update vector store: {store_name}")
|
| 92 |
repo.git_push()
|
| 93 |
-
st.text("Committed and pushed vector store to repository.")
|
| 94 |
except Exception as e:
|
| 95 |
st.error(f"Error during Git operations: {e}")
|
| 96 |
finally:
|
|
@@ -513,16 +513,16 @@ def main():
|
|
| 513 |
st.title('BinDoc GmbH')
|
| 514 |
st.markdown("Experience revolutionary interaction with BinDocs Chat App, leveraging state-of-the-art AI technology.")
|
| 515 |
add_vertical_space(1)
|
| 516 |
-
page = st.sidebar.selectbox("Choose a page", ["Kosten- und Strukturdaten der Krankenhäuser"
|
| 517 |
add_vertical_space(1)
|
| 518 |
st.write('Made with ❤️ by BinDoc GmbH')
|
| 519 |
|
| 520 |
# Main area content based on page selection
|
| 521 |
-
if page == "
|
| 522 |
page1()
|
| 523 |
-
elif page == "KH_Reform":
|
| 524 |
-
page2()
|
| 525 |
elif page == "Kennzahlenbuch 100 Kennzahlen":
|
|
|
|
|
|
|
| 526 |
page3()
|
| 527 |
|
| 528 |
|
|
|
|
| 63 |
if not force_reload and os.path.exists(vector_store_path):
|
| 64 |
with open(vector_store_path, "rb") as f:
|
| 65 |
VectorStore = pickle.load(f)
|
| 66 |
+
#st.text(f"Loaded existing vector store from {vector_store_path}")
|
| 67 |
else:
|
| 68 |
# Load and process the PDF, then create the vector store
|
| 69 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200, length_function=len)
|
|
|
|
| 75 |
# Serialize the vector store
|
| 76 |
with open(vector_store_path, "wb") as f:
|
| 77 |
pickle.dump(VectorStore, f)
|
| 78 |
+
#st.text(f"Created and saved vector store at {vector_store_path}")
|
| 79 |
|
| 80 |
# Change working directory for Git operations
|
| 81 |
original_dir = os.getcwd()
|
|
|
|
| 83 |
|
| 84 |
try:
|
| 85 |
# Check current working directory and list files for debugging
|
| 86 |
+
#st.text(f"Current working directory: {os.getcwd()}")
|
| 87 |
+
#st.text(f"Files in current directory: {os.listdir()}")
|
| 88 |
|
| 89 |
# Adjusted file path for Git command
|
| 90 |
repo.git_add(f"{store_name}.pkl") # Use just the file name
|
| 91 |
repo.git_commit(f"Update vector store: {store_name}")
|
| 92 |
repo.git_push()
|
| 93 |
+
#st.text("Committed and pushed vector store to repository.")
|
| 94 |
except Exception as e:
|
| 95 |
st.error(f"Error during Git operations: {e}")
|
| 96 |
finally:
|
|
|
|
| 513 |
st.title('BinDoc GmbH')
|
| 514 |
st.markdown("Experience revolutionary interaction with BinDocs Chat App, leveraging state-of-the-art AI technology.")
|
| 515 |
add_vertical_space(1)
|
| 516 |
+
page = st.sidebar.selectbox("Choose a page", ["KH_Reform", "Kennzahlenbuch 100 Kennzahlen", "Kosten- und Strukturdaten der Krankenhäuser"])
|
| 517 |
add_vertical_space(1)
|
| 518 |
st.write('Made with ❤️ by BinDoc GmbH')
|
| 519 |
|
| 520 |
# Main area content based on page selection
|
| 521 |
+
if page == "KH_Reform":
|
| 522 |
page1()
|
|
|
|
|
|
|
| 523 |
elif page == "Kennzahlenbuch 100 Kennzahlen":
|
| 524 |
+
page2()
|
| 525 |
+
elif page == "Kosten- und Strukturdaten der Krankenhäuser":
|
| 526 |
page3()
|
| 527 |
|
| 528 |
|