Created a Space a few weeks ago which had an OCR component to it (after the user uploaded a PDF, it checked if the PDF was OCRd and, if not, made a call to Azure OCR API (pre-trained layout model previously called Azure Form Recognizer, now called Document Intelligence) to extract the text).
Space worked with no issues until last Friday when it started to throw a Name Resolution error.
ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x7f52d9bab5b0>: Failed to resolve '[app-name].cognitiveservices.azure.com' ([Errno -3] Temporary failure in name resolution)
Traceback:
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
exec(code, module.__dict__)
File "/home/user/app/app.py", line 206, in <module>
main()
File "/home/user/app/app.py", line 168, in main
pdf_text = pdf_reader(file_path)
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 211, in wrapper
return cached_func(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 240, in __call__
return self._get_or_create_cached_value(args, kwargs)
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 266, in _get_or_create_cached_value
return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "/home/user/.local/lib/python3.10/site-packages/streamlit/runtime/caching/cache_utils.py", line 320, in _handle_cache_miss
computed_value = self._info.func(*func_args, **func_kwargs)
File "/home/user/app/app.py", line 160, in pdf_reader
pdf_text = read_pdf(file_path)
File "/home/user/app/utils.py", line 48, in read_pdf
extracted_text = azure_ocr(input_file_path) if not pdf_text else pdf_text
File "/home/user/app/utils.py", line 69, in azure_ocr
poller = document_analysis_client.begin_analyze_document(
File "/home/user/.local/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/azure/ai/formrecognizer/_document_analysis_client.py", line 129, in begin_analyze_document
return _client_op_path.begin_analyze_document( # type: ignore
File "/home/user/.local/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "/home/user/.local/lib/python3.10/site-packages/azure/ai/formrecognizer/_generated/v2023_07_31/operations/_document_models_operations.py", line 518, in begin_analyze_document
raw_result = self._analyze_document_initial( # type: ignore
File "/home/user/.local/lib/python3.10/site-packages/azure/ai/formrecognizer/_generated/v2023_07_31/operations/_document_models_operations.py", line 434, in _analyze_document_initial
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 230, in run
return first_node.send(pipeline_request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
[Previous line repeated 2 more times]
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/policies/_redirect.py", line 197, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/policies/_retry.py", line 553, in send
raise err
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/policies/_retry.py", line 531, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 86, in send
response = self.next.send(request)
[Previous line repeated 4 more times]
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/_base.py", line 119, in send
self._sender.send(request.http_request, **request.context.options),
File "/home/user/.local/lib/python3.10/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 381, in send
raise error
Nothing in the code changed. The call to Azure OCR API is the same and their API has not changed. Searched everywhere and could not find what changed on the Hugging Face side to cause this error.
The error is severe enough because it renders the app unusable with any PDF that is not already OCRd. Any help is appreciated.