init
Browse files
app.py
CHANGED
|
@@ -28,6 +28,15 @@ local_path = snapshot_download(
|
|
| 28 |
revision="main",
|
| 29 |
)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
NUM = r"[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?"
|
| 33 |
CAM_PATTERN = re.compile(r"(?:camera parameters.*?:|roll.*?:)\s*("+NUM+r")\s*,\s*("+NUM+r")\s*,\s*("+NUM+r")", re.IGNORECASE|re.DOTALL)
|
|
@@ -48,6 +57,10 @@ checkpoint_path = "checkpoints/Puffin-Base.pth"
|
|
| 48 |
checkpoint = torch.load(checkpoint_path)
|
| 49 |
info = model.load_state_dict(checkpoint, strict=False)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
def fig_to_image(fig):
|
| 52 |
buf = io.BytesIO()
|
| 53 |
fig.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|
|
|
|
| 28 |
revision="main",
|
| 29 |
)
|
| 30 |
|
| 31 |
+
local_path_vae = snapshot_download(
|
| 32 |
+
repo_id="wusize/Puffin",
|
| 33 |
+
repo_type="model",
|
| 34 |
+
#filename="Puffin-Base.pth",
|
| 35 |
+
local_dir="checkpoints_vae/",
|
| 36 |
+
local_dir_use_symlinks=False,
|
| 37 |
+
revision="main",
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
|
| 41 |
NUM = r"[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?"
|
| 42 |
CAM_PATTERN = re.compile(r"(?:camera parameters.*?:|roll.*?:)\s*("+NUM+r")\s*,\s*("+NUM+r")\s*,\s*("+NUM+r")", re.IGNORECASE|re.DOTALL)
|
|
|
|
| 57 |
checkpoint = torch.load(checkpoint_path)
|
| 58 |
info = model.load_state_dict(checkpoint, strict=False)
|
| 59 |
|
| 60 |
+
checkpoint_path_vae = "checkpoints_vae/vae.pth"
|
| 61 |
+
checkpoint_vae = torch.load(checkpoint_path_vae)
|
| 62 |
+
info_vae = model.vae.load_state_dict(checkpoint_vae, strict=False)
|
| 63 |
+
|
| 64 |
def fig_to_image(fig):
|
| 65 |
buf = io.BytesIO()
|
| 66 |
fig.savefig(buf, format='png', bbox_inches='tight', pad_inches=0)
|