Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
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(
|
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
|