Anne31415 commited on
Commit
27f0cf3
·
verified ·
1 Parent(s): 9844e99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -69,6 +69,16 @@ pdf_path3 = "Private_Book/Kosten_Strukturdaten_RAG_vorbereited.pdf"
69
  api_key = os.getenv("OPENAI_API_KEY")
70
  # Retrieve the API key from st.secrets
71
 
 
 
 
 
 
 
 
 
 
 
72
 
73
 
74
  @st.cache_resource
 
69
  api_key = os.getenv("OPENAI_API_KEY")
70
  # Retrieve the API key from st.secrets
71
 
72
+ @st.cache
73
+ def extract_text_from_pdf(pdf_path):
74
+ text = ""
75
+ reader = PdfReader(pdf_path)
76
+ for page in reader.pages:
77
+ text += page.extract_text() + " " # Concatenate text from each page
78
+ return text
79
+
80
+ # Use the function to get pdf_text
81
+ pdf_text = extract_text_from_pdf(pdf_path3)
82
 
83
 
84
  @st.cache_resource