Spaces:
Sleeping
Sleeping
Update azure_ocr.py
Browse files- 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 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
if not
|
| 12 |
-
|
| 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:
|