Spaces:
Running on Zero
Running on Zero
Publish services/inference
Browse files- space_app.py +10 -0
space_app.py
CHANGED
|
@@ -67,6 +67,16 @@ from pathlib import Path
|
|
| 67 |
|
| 68 |
HERE = Path(__file__).resolve().parent
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
# **Before the service is imported.** `providers.discover()` reads the artefacts
|
| 71 |
# at import time, and a checksum that disagrees with its card should stop the
|
| 72 |
# Space rather than be discovered by a farm's job. On Docker this was a build
|
|
|
|
| 67 |
|
| 68 |
HERE = Path(__file__).resolve().parent
|
| 69 |
|
| 70 |
+
# **The demo captures, and where they now live.**
|
| 71 |
+
#
|
| 72 |
+
# The Docker Space copied them to `/media` in a `Dockerfile.append` stanza. A
|
| 73 |
+
# Gradio Space has no Dockerfile, so `publish.py` stages them into
|
| 74 |
+
# `space/fixtures/` in the repo and this points the media store at that. Without
|
| 75 |
+
# it every job fails with "No media file for … under /home/user/app/media",
|
| 76 |
+
# which is the service correctly refusing to invent a photograph.
|
| 77 |
+
os.environ.setdefault("ANIMAP_MEDIA_PROVIDER", "local")
|
| 78 |
+
os.environ["ANIMAP_MEDIA_ROOT"] = str(HERE / "space" / "fixtures")
|
| 79 |
+
|
| 80 |
# **Before the service is imported.** `providers.discover()` reads the artefacts
|
| 81 |
# at import time, and a checksum that disagrees with its card should stop the
|
| 82 |
# Space rather than be discovered by a farm's job. On Docker this was a build
|