wonjun12 commited on
Commit
279e5cf
·
verified ·
1 Parent(s): 714bb89

Code is private: the container fetches bundle 182f3fd19931573c from the private repo at start-up (public files 9cab7a8f56d0a6db)

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -3
Dockerfile CHANGED
@@ -20,9 +20,9 @@ RUN python -c "from transformers import CLIPVisionModelWithProjection as M; M.fr
20
 
21
  RUN chown appuser:appuser /app
22
  ENV AEYE_CODE_REPO=wonjun12/aeye-weights \
23
- AEYE_CODE_REVISION=8b963204bac9047d895deb55fac63b46c98d7c22 \
24
- AEYE_CODE_FILE=code/aeye-backend-a287e3266d7a7b91.tar.gz \
25
- AEYE_CODE_SHA256=a287e3266d7a7b91b5977cdfffe97b04b281e7cf8d1c4b1fb2d71bd1e249f4fe
26
 
27
  USER appuser
28
 
@@ -50,5 +50,9 @@ ENV VERDICT_MODEL_PATH=/app/models/best91.pt \
50
  AEYE_FUSION=on \
51
  AEYE_FUSION_PATH=./fusion/fusion_rc2.json
52
 
 
 
 
 
53
  EXPOSE 7860
54
  CMD ["python", "-c", "import compileall, hashlib, io, os, sys, tarfile, time, requests\nARGV = ['python', '-m', 'uvicorn', 'main_hybrid:app', '--host', '0.0.0.0', '--port', '7860', '--workers', '1', '--limit-concurrency', '64', '--timeout-keep-alive', '5']\nrepo, rev, path, want = (os.environ[k] for k in ('AEYE_CODE_REPO', 'AEYE_CODE_REVISION', 'AEYE_CODE_FILE', 'AEYE_CODE_SHA256'))\nurl = 'https://huggingface.co/%s/resolve/%s/%s' % (repo, rev, path)\ntoken = os.environ.get('HF_TOKEN', '').strip()\ndelay, deadline = 5, time.time() + 600\nwhile True:\n try:\n r = requests.get(url, headers={'Authorization': 'Bearer ' + token}, timeout=(10, 300))\n why = 'HTTP %d' % r.status_code\n except requests.RequestException as exc:\n r, why = None, type(exc).__name__\n if r is not None and r.status_code == 200:\n break\n if r is not None and r.status_code in (401, 403, 404):\n sys.exit('[start] the code bundle is not readable (%s) - is the Space secret HF_TOKEN set?' % why)\n if time.time() > deadline:\n sys.exit('[start] the code bundle could not be downloaded for 10 minutes (%s)' % why)\n print('[start] code download: %s - retrying in %ds' % (why, delay), flush=True)\n time.sleep(delay)\n delay = min(delay * 2, 60)\ndata = r.content\ngot = hashlib.sha256(data).hexdigest()\nif got != want:\n sys.exit('[start] code bundle sha256 %s is not the pinned %s' % (got, want))\ntarfile.open(fileobj=io.BytesIO(data), mode='r:gz').extractall('/app', filter='data')\nif not compileall.compile_dir('/app', legacy=True, quiet=1):\n sys.exit('[start] the code bundle did not compile')\nfor folder, _, names in os.walk('/app'):\n for name in names:\n if name.endswith('.py'):\n os.remove(os.path.join(folder, name))\nprint('[start] code %s (%s) ready' % (path, got[:16]), flush=True)\nos.chdir('/app')\nos.execvp(ARGV[0], ARGV)"]
 
20
 
21
  RUN chown appuser:appuser /app
22
  ENV AEYE_CODE_REPO=wonjun12/aeye-weights \
23
+ AEYE_CODE_REVISION=ecb75af6b74ed127352eeedb0e75362292f91ada \
24
+ AEYE_CODE_FILE=code/aeye-backend-182f3fd19931573c.tar.gz \
25
+ AEYE_CODE_SHA256=182f3fd19931573cb36cd4c3eceb6101cef87e4be4d8dad6014b0fe9a15a0d44
26
 
27
  USER appuser
28
 
 
50
  AEYE_FUSION=on \
51
  AEYE_FUSION_PATH=./fusion/fusion_rc2.json
52
 
53
+ ENV AEYE_SCREEN_PATH=on \
54
+ AEYE_SCREEN_PATH_RULE_ID=0817db71477e569d \
55
+ AEYE_SCREEN_PATH_FOR=246d25f0c991bb95
56
+
57
  EXPOSE 7860
58
  CMD ["python", "-c", "import compileall, hashlib, io, os, sys, tarfile, time, requests\nARGV = ['python', '-m', 'uvicorn', 'main_hybrid:app', '--host', '0.0.0.0', '--port', '7860', '--workers', '1', '--limit-concurrency', '64', '--timeout-keep-alive', '5']\nrepo, rev, path, want = (os.environ[k] for k in ('AEYE_CODE_REPO', 'AEYE_CODE_REVISION', 'AEYE_CODE_FILE', 'AEYE_CODE_SHA256'))\nurl = 'https://huggingface.co/%s/resolve/%s/%s' % (repo, rev, path)\ntoken = os.environ.get('HF_TOKEN', '').strip()\ndelay, deadline = 5, time.time() + 600\nwhile True:\n try:\n r = requests.get(url, headers={'Authorization': 'Bearer ' + token}, timeout=(10, 300))\n why = 'HTTP %d' % r.status_code\n except requests.RequestException as exc:\n r, why = None, type(exc).__name__\n if r is not None and r.status_code == 200:\n break\n if r is not None and r.status_code in (401, 403, 404):\n sys.exit('[start] the code bundle is not readable (%s) - is the Space secret HF_TOKEN set?' % why)\n if time.time() > deadline:\n sys.exit('[start] the code bundle could not be downloaded for 10 minutes (%s)' % why)\n print('[start] code download: %s - retrying in %ds' % (why, delay), flush=True)\n time.sleep(delay)\n delay = min(delay * 2, 60)\ndata = r.content\ngot = hashlib.sha256(data).hexdigest()\nif got != want:\n sys.exit('[start] code bundle sha256 %s is not the pinned %s' % (got, want))\ntarfile.open(fileobj=io.BytesIO(data), mode='r:gz').extractall('/app', filter='data')\nif not compileall.compile_dir('/app', legacy=True, quiet=1):\n sys.exit('[start] the code bundle did not compile')\nfor folder, _, names in os.walk('/app'):\n for name in names:\n if name.endswith('.py'):\n os.remove(os.path.join(folder, name))\nprint('[start] code %s (%s) ready' % (path, got[:16]), flush=True)\nos.chdir('/app')\nos.execvp(ARGV[0], ARGV)"]