Spaces:
Running on Zero
Running on Zero
Vendor RIFE into repo
Browse files
app.py
CHANGED
|
@@ -1815,10 +1815,25 @@ def build_example_media_html(media_path: Optional[str], media_type: str, fallbac
|
|
| 1815 |
return f'<img class="example-preview-image" src="{html.escape(url, quote=True)}" alt="{alt_text}" loading="lazy" />'
|
| 1816 |
|
| 1817 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1818 |
RECOMMENDED_OUTPUT_CACHE_DIR = Path(
|
| 1819 |
-
os.getenv("LANCE_RECOMMENDED_OUTPUT_CACHE_DIR", str(
|
| 1820 |
).expanduser()
|
| 1821 |
-
ASSET_RECOMMENDED_OUTPUT_CACHE_DIR =
|
| 1822 |
RECOMMENDED_CASE_CACHE: dict[str, dict] = {}
|
| 1823 |
|
| 1824 |
|
|
@@ -1855,7 +1870,8 @@ def _default_recommended_output_name(task: str, example_id: str) -> str:
|
|
| 1855 |
|
| 1856 |
|
| 1857 |
def _cache_roots() -> list[Path]:
|
| 1858 |
-
|
|
|
|
| 1859 |
unique_roots: list[Path] = []
|
| 1860 |
seen = set()
|
| 1861 |
for root in roots:
|
|
|
|
| 1815 |
return f'<img class="example-preview-image" src="{html.escape(url, quote=True)}" alt="{alt_text}" loading="lazy" />'
|
| 1816 |
|
| 1817 |
|
| 1818 |
+
# Recommended-case cache under the app.py directory. Runtime generated caches are
|
| 1819 |
+
# written here by default, so each case can be committed with the repository.
|
| 1820 |
+
LOCAL_RECOMMENDED_OUTPUT_CACHE_DIR = Path(
|
| 1821 |
+
os.getenv("LANCE_LOCAL_RECOMMENDED_OUTPUT_CACHE_DIR", str(REPO_ROOT / "lance_gradio" / "recommended_outputs"))
|
| 1822 |
+
).expanduser()
|
| 1823 |
+
|
| 1824 |
+
# Space/runtime cache root. This is kept as a read/query fallback so the app can
|
| 1825 |
+
# still hit caches that were previously saved on the running Space instance.
|
| 1826 |
+
SPACE_RECOMMENDED_OUTPUT_CACHE_DIR = Path(
|
| 1827 |
+
os.getenv("LANCE_SPACE_RECOMMENDED_OUTPUT_CACHE_DIR", str(GRADIO_TMP_ROOT / "recommended_outputs"))
|
| 1828 |
+
).expanduser()
|
| 1829 |
+
|
| 1830 |
+
# Writable cache target used by store_recommended_cached_result(). By default this
|
| 1831 |
+
# is app.py's directory / lance_gradio / recommended_outputs. Set
|
| 1832 |
+
# LANCE_RECOMMENDED_OUTPUT_CACHE_DIR to override it explicitly.
|
| 1833 |
RECOMMENDED_OUTPUT_CACHE_DIR = Path(
|
| 1834 |
+
os.getenv("LANCE_RECOMMENDED_OUTPUT_CACHE_DIR", str(LOCAL_RECOMMENDED_OUTPUT_CACHE_DIR))
|
| 1835 |
).expanduser()
|
| 1836 |
+
ASSET_RECOMMENDED_OUTPUT_CACHE_DIR = LOCAL_RECOMMENDED_OUTPUT_CACHE_DIR
|
| 1837 |
RECOMMENDED_CASE_CACHE: dict[str, dict] = {}
|
| 1838 |
|
| 1839 |
|
|
|
|
| 1870 |
|
| 1871 |
|
| 1872 |
def _cache_roots() -> list[Path]:
|
| 1873 |
+
"""Query the new local cache first, then the Space/runtime saved cache."""
|
| 1874 |
+
roots = [RECOMMENDED_OUTPUT_CACHE_DIR, SPACE_RECOMMENDED_OUTPUT_CACHE_DIR]
|
| 1875 |
unique_roots: list[Path] = []
|
| 1876 |
seen = set()
|
| 1877 |
for root in roots:
|
lance_gradio/recommended_outputs/t2v/000000__sig-25135034e76e01164e4c.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:13cfb5489048ec60926ca6c2a08c68c7dacfad17cbd26f782260a15f6ce15fc9
|
| 3 |
+
size 624624
|
lance_gradio/recommended_outputs/t2v/000004__sig-19d9983e47c6ab5747fc.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f65cf413fb63d1de1646d8d0266f8ab465c8e83b85b7d1678ec01e6f49db4fa7
|
| 3 |
+
size 391551
|