akshansh36 commited on
Commit
3a79f66
·
verified ·
1 Parent(s): 995c275

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -8,15 +8,21 @@ from PyPDF2 import PdfReader, PdfWriter
8
  from openai import OpenAI
9
  import re
10
  import json
 
11
 
12
- os.environ["OPENAI_API_KEY"] = "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"
 
 
 
 
 
13
 
14
  openaiClient = OpenAI()
15
 
16
  # Initialize the DocumentAnalysisClient
17
  document_analysis_client = DocumentAnalysisClient(
18
  endpoint="https://youdata-demo.cognitiveservices.azure.com/",
19
- credential=AzureKeyCredential("8a7e9f72359740108a9a20529eeb136a") # Replace with your Azure key
20
  )
21
 
22
  # Function to split PDF and extract the first 4 pages
 
8
  from openai import OpenAI
9
  import re
10
  import json
11
+ from dotenv import load_dotenv
12
 
13
+ load_dotenv()
14
+
15
+ OPENAI_API_KEY=os.getenv("OPENAI_API_KEY")
16
+
17
+ os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
18
+ AZURE_KEY=os.getenv("AZURE_KEY")
19
 
20
  openaiClient = OpenAI()
21
 
22
  # Initialize the DocumentAnalysisClient
23
  document_analysis_client = DocumentAnalysisClient(
24
  endpoint="https://youdata-demo.cognitiveservices.azure.com/",
25
+ credential=AzureKeyCredential(AZURE_KEY) # Replace with your Azure key
26
  )
27
 
28
  # Function to split PDF and extract the first 4 pages