Spaces:
Running on Zero
Running on Zero
Publish
Browse files
app.py
CHANGED
|
@@ -650,6 +650,10 @@ def generate_video(
|
|
| 650 |
)
|
| 651 |
print(f"GPU complete: {task_n}")
|
| 652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 653 |
return (video_path if video_component else None), video_path, current_seed
|
| 654 |
|
| 655 |
|
|
@@ -783,6 +787,44 @@ GLASS_JS = """
|
|
| 783 |
"""
|
| 784 |
|
| 785 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 786 |
with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
| 787 |
|
| 788 |
# ── TITLE & SUBTITLE — float freely ──
|
|
@@ -929,4 +971,4 @@ if __name__ == "__main__":
|
|
| 929 |
head=f"<style>{GLASS_CSS}</style>{GLASS_JS}",
|
| 930 |
theme=theme,
|
| 931 |
show_error=True,
|
| 932 |
-
)
|
|
|
|
| 650 |
)
|
| 651 |
print(f"GPU complete: {task_n}")
|
| 652 |
|
| 653 |
+
try:
|
| 654 |
+
publish_agent_pipe_lora_catalog()
|
| 655 |
+
except Exception as catalog_error:
|
| 656 |
+
print(f"Agent Pipe video catalog refresh failed: {catalog_error}")
|
| 657 |
return (video_path if video_component else None), video_path, current_seed
|
| 658 |
|
| 659 |
|
|
|
|
| 787 |
"""
|
| 788 |
|
| 789 |
|
| 790 |
+
AGENT_PIPE_CATALOG_PATH = os.getenv(
|
| 791 |
+
"AGENT_PIPE_VIDEO_CATALOG", "/data/agent-pipe/catalogs/video.json"
|
| 792 |
+
)
|
| 793 |
+
|
| 794 |
+
|
| 795 |
+
def publish_agent_pipe_lora_catalog():
|
| 796 |
+
"""Atomically publish the LoRAs this running video worker can actually load."""
|
| 797 |
+
entries = [
|
| 798 |
+
{"name": str(name)}
|
| 799 |
+
for name in sorted(lora_loader.get_lora_choices(), key=str.casefold)
|
| 800 |
+
if str(name).lower() != "none"
|
| 801 |
+
]
|
| 802 |
+
payload = {
|
| 803 |
+
"schema": "agent-pipe.lora-catalog.v1",
|
| 804 |
+
"kind": "video",
|
| 805 |
+
"source_space": os.getenv("SPACE_ID", "Quantumbraid/agent.video"),
|
| 806 |
+
"published_at": __import__("datetime").datetime.now(
|
| 807 |
+
__import__("datetime").timezone.utc
|
| 808 |
+
).isoformat(),
|
| 809 |
+
"loras": entries,
|
| 810 |
+
}
|
| 811 |
+
target = AGENT_PIPE_CATALOG_PATH
|
| 812 |
+
os.makedirs(os.path.dirname(target), exist_ok=True)
|
| 813 |
+
temporary = f"{target}.tmp.{os.getpid()}"
|
| 814 |
+
with open(temporary, "w", encoding="utf-8") as handle:
|
| 815 |
+
__import__("json").dump(payload, handle, ensure_ascii=False, indent=2)
|
| 816 |
+
handle.flush()
|
| 817 |
+
os.fsync(handle.fileno())
|
| 818 |
+
os.replace(temporary, target)
|
| 819 |
+
return payload
|
| 820 |
+
|
| 821 |
+
|
| 822 |
+
try:
|
| 823 |
+
publish_agent_pipe_lora_catalog()
|
| 824 |
+
except Exception as catalog_error:
|
| 825 |
+
print(f"Initial Agent Pipe video catalog publish failed: {catalog_error}")
|
| 826 |
+
|
| 827 |
+
|
| 828 |
with gr.Blocks(delete_cache=(3600, 10800)) as demo:
|
| 829 |
|
| 830 |
# ── TITLE & SUBTITLE — float freely ──
|
|
|
|
| 971 |
head=f"<style>{GLASS_CSS}</style>{GLASS_JS}",
|
| 972 |
theme=theme,
|
| 973 |
show_error=True,
|
| 974 |
+
)
|