Gagandeep12 commited on
Commit
2b7e514
·
verified ·
1 Parent(s): 10c4084

Update azure_ocr.py

Browse files
Files changed (1) hide show
  1. azure_ocr.py +6 -8
azure_ocr.py CHANGED
@@ -5,14 +5,12 @@ from PyPDF2 import PdfReader, PdfWriter
5
  import tempfile
6
  import re
7
 
8
- AZURE_ENDPOINT = os.env.get("AZURE_ENDPOINT")
9
- AZURE_KEY = os.env.get("AZURE_KEY")
10
-
11
- if not AZURE_ENDPOINT or not AZURE_KEY:
12
- raise RuntimeError("Set AZURE_ENDPOINT and AZURE_KEY in .env")
13
-
14
- AZURE_ENDPOINT = AZURE_ENDPOINT.rstrip("/")
15
-
16
 
17
  def read_file_bytes(path):
18
  with open(path, "rb") as f:
 
5
  import tempfile
6
  import re
7
 
8
+ def get_azure_config():
9
+ endpoint = os.environ.get("AZURE_ENDPOINT")
10
+ key = os.environ.get("AZURE_KEY")
11
+ if not endpoint or not key:
12
+ raise RuntimeError("Set AZURE_ENDPOINT and AZURE_KEY in .env or environment")
13
+ return endpoint.rstrip("/"), key
 
 
14
 
15
  def read_file_bytes(path):
16
  with open(path, "rb") as f: