have the patience of a saint..
Browse files- gradio_app.py +15 -0
gradio_app.py
CHANGED
|
@@ -3,6 +3,7 @@ import torch
|
|
| 3 |
import os
|
| 4 |
import time
|
| 5 |
import datetime
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from moviepy.editor import VideoFileClip
|
| 8 |
import gradio as gr
|
|
@@ -25,6 +26,20 @@ subfolders = [
|
|
| 25 |
for subfolder in subfolders:
|
| 26 |
(WEIGHTS_ROOT / subfolder).mkdir(parents=True, exist_ok=True)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
snapshot_download(repo_id="lixiaowen/diffuEraser", local_dir=str(WEIGHTS_ROOT / "diffuEraser"))
|
| 29 |
snapshot_download(repo_id="stable-diffusion-v1-5/stable-diffusion-v1-5", local_dir=str(WEIGHTS_ROOT / "stable-diffusion-v1-5"))
|
| 30 |
snapshot_download(repo_id="wangfuyun/PCM_Weights", local_dir=str(WEIGHTS_ROOT / "PCM_Weights"))
|
|
|
|
| 3 |
import os
|
| 4 |
import time
|
| 5 |
import datetime
|
| 6 |
+
import shutil
|
| 7 |
from pathlib import Path
|
| 8 |
from moviepy.editor import VideoFileClip
|
| 9 |
import gradio as gr
|
|
|
|
| 26 |
for subfolder in subfolders:
|
| 27 |
(WEIGHTS_ROOT / subfolder).mkdir(parents=True, exist_ok=True)
|
| 28 |
|
| 29 |
+
# Make sure legacy code that references ./weights still works by linking it to the persistent cache root.
|
| 30 |
+
workspace_weights = Path("./weights")
|
| 31 |
+
try:
|
| 32 |
+
if WEIGHTS_ROOT.resolve() != workspace_weights.resolve():
|
| 33 |
+
if workspace_weights.exists():
|
| 34 |
+
if workspace_weights.is_symlink() or workspace_weights.is_file():
|
| 35 |
+
workspace_weights.unlink()
|
| 36 |
+
else:
|
| 37 |
+
shutil.rmtree(workspace_weights)
|
| 38 |
+
workspace_weights.symlink_to(WEIGHTS_ROOT, target_is_directory=True)
|
| 39 |
+
except FileNotFoundError:
|
| 40 |
+
# resolve() can raise if the symlink target is missing; ignore until directories exist
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
snapshot_download(repo_id="lixiaowen/diffuEraser", local_dir=str(WEIGHTS_ROOT / "diffuEraser"))
|
| 44 |
snapshot_download(repo_id="stable-diffusion-v1-5/stable-diffusion-v1-5", local_dir=str(WEIGHTS_ROOT / "stable-diffusion-v1-5"))
|
| 45 |
snapshot_download(repo_id="wangfuyun/PCM_Weights", local_dir=str(WEIGHTS_ROOT / "PCM_Weights"))
|