mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(docker): add User-Agent header to model downloads
The Berkeley colorization server returns 403 for the default Python-urllib User-Agent. Setting a global opener fixes this for all model downloads.
This commit is contained in:
@@ -7,6 +7,11 @@ import os
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
# Some servers (e.g. Berkeley) block the default Python-urllib User-Agent.
|
||||
_opener = urllib.request.build_opener()
|
||||
_opener.addheaders = [("User-Agent", "Stirling-Image/1.0")]
|
||||
urllib.request.install_opener(_opener)
|
||||
|
||||
# Force CPU mode during build - no GPU driver available at build time.
|
||||
# Must be set before any ML library import.
|
||||
os.environ["PADDLE_DEVICE"] = "cpu"
|
||||
|
||||
Reference in New Issue
Block a user