Anne31415 commited on
Commit
54bfbb9
·
verified ·
1 Parent(s): 52f283a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -72,11 +72,6 @@ api_key = os.getenv("OPENAI_API_KEY")
72
 
73
  import chromadb
74
 
75
- # Initialize CromA client
76
- chroma_client = chromadb.Client()
77
-
78
- # Later in your code, use chroma_client to create a collection
79
- collection = chroma_client.create_collection(name="Kosten_Strukturdaten")
80
 
81
 
82
  # Function to extract text from a PDF file
@@ -90,13 +85,6 @@ def extract_text_from_pdf(pdf_path):
90
  # Example usage
91
  pdf_text = extract_text_from_pdf(pdf_path3)
92
 
93
- # Add the extracted text from PDF to the Chroma collection
94
- collection.add(
95
- documents=[pdf_text],
96
- metadatas=[{"source": pdf_path3}], # Add any relevant metadata for your document
97
- ids=[("Kosten_Strukturdaten")]
98
- )
99
-
100
 
101
  @st.cache_resource
102
  def load_vector_store(file_path, store_name, force_reload=False):
@@ -539,6 +527,13 @@ def page3():
539
  chroma_client = chromadb.Client()
540
  collection = chroma_client.create_collection(name="Kosten_Strukturdaten")
541
 
 
 
 
 
 
 
 
542
  display_chat_history(st.session_state['chat_history_page3'])
543
 
544
  st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
 
72
 
73
  import chromadb
74
 
 
 
 
 
 
75
 
76
 
77
  # Function to extract text from a PDF file
 
85
  # Example usage
86
  pdf_text = extract_text_from_pdf(pdf_path3)
87
 
 
 
 
 
 
 
 
88
 
89
  @st.cache_resource
90
  def load_vector_store(file_path, store_name, force_reload=False):
 
527
  chroma_client = chromadb.Client()
528
  collection = chroma_client.create_collection(name="Kosten_Strukturdaten")
529
 
530
+ # Add the extracted text from PDF to the Chroma collection
531
+ collection.add(
532
+ documents=[pdf_text],
533
+ metadatas=[{"source": pdf_path3}], # Add any relevant metadata for your document
534
+ ids=[("Kosten_Strukturdaten")]
535
+ )
536
+
537
  display_chat_history(st.session_state['chat_history_page3'])
538
 
539
  st.write("<!-- Start Spacer -->", unsafe_allow_html=True)