Spaces:
Running
Running
minor thing
Browse files- app.py +33 -14
- dataset_utils.py +2 -2
- download_deps.py +2 -2
app.py
CHANGED
|
@@ -27,25 +27,44 @@ except Exception as e:
|
|
| 27 |
|
| 28 |
# Example videos
|
| 29 |
example_videos = [
|
| 30 |
-
"./examples/
|
| 31 |
-
"./examples/
|
| 32 |
-
"./examples/
|
| 33 |
-
"./examples/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
]
|
| 35 |
# Example videos
|
| 36 |
example_keys = [
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
]
|
| 42 |
# Example videos
|
| 43 |
example_texts = [
|
| 44 |
-
"
|
| 45 |
-
"
|
| 46 |
-
"
|
| 47 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
]
|
|
|
|
| 49 |
example_video_outputs = [gr.Video(label=f"Example {i+1}",
|
| 50 |
value=example_videos[i])
|
| 51 |
for i in range(4)]
|
|
@@ -55,9 +74,9 @@ class MotionEditor:
|
|
| 55 |
# Don't initialize any CUDA components in __init__
|
| 56 |
self.is_initialized = False
|
| 57 |
self.MFIX_p = download_motionfix() + '/motionfix'
|
| 58 |
-
self.SOURCE_MOTS_p = download_embeddings() + '/embeddings'
|
| 59 |
self.MFIX_DATASET_DICT = download_motionfix_dataset()
|
| 60 |
-
self.model_ckpt_path = download_models()
|
| 61 |
self.model_config_feats = download_model_config()
|
| 62 |
|
| 63 |
@spaces.GPU
|
|
|
|
| 27 |
|
| 28 |
# Example videos
|
| 29 |
example_videos = [
|
| 30 |
+
"./examples/001919.mp4",
|
| 31 |
+
"./examples/005376.mp4",
|
| 32 |
+
"./examples/001259.mp4",
|
| 33 |
+
"./examples/003686.mp4",
|
| 34 |
+
"./examples/001289.mp4",
|
| 35 |
+
"./examples/001893.mp4",
|
| 36 |
+
"./examples/003262.mp4",
|
| 37 |
+
"./examples/006117.mp4",
|
| 38 |
+
"./examples/001031.mp4",
|
| 39 |
+
"./examples/006247.mp4",
|
| 40 |
]
|
| 41 |
# Example videos
|
| 42 |
example_keys = [
|
| 43 |
+
"001919",
|
| 44 |
+
"005376",
|
| 45 |
+
"001259",
|
| 46 |
+
"003686",
|
| 47 |
+
"001289",
|
| 48 |
+
"001893",
|
| 49 |
+
"003262",
|
| 50 |
+
"006117",
|
| 51 |
+
"001031",
|
| 52 |
+
"006247",
|
| 53 |
]
|
| 54 |
# Example videos
|
| 55 |
example_texts = [
|
| 56 |
+
"mirror",
|
| 57 |
+
"move in a smaller circle",
|
| 58 |
+
"less deep",
|
| 59 |
+
"turn back faster",
|
| 60 |
+
"cross your legs",
|
| 61 |
+
"step to the right",
|
| 62 |
+
"start sitting down a bit later",
|
| 63 |
+
"start a bit later, hold elbow lower at the end",
|
| 64 |
+
"extend the arm further back and catch higher",
|
| 65 |
+
"hold right arm higher",
|
| 66 |
]
|
| 67 |
+
|
| 68 |
example_video_outputs = [gr.Video(label=f"Example {i+1}",
|
| 69 |
value=example_videos[i])
|
| 70 |
for i in range(4)]
|
|
|
|
| 74 |
# Don't initialize any CUDA components in __init__
|
| 75 |
self.is_initialized = False
|
| 76 |
self.MFIX_p = download_motionfix() + '/motionfix'
|
| 77 |
+
# self.SOURCE_MOTS_p = download_embeddings() + '/embeddings'
|
| 78 |
self.MFIX_DATASET_DICT = download_motionfix_dataset()
|
| 79 |
+
self.model_ckpt_path = download_models("last_zipped")
|
| 80 |
self.model_config_feats = download_model_config()
|
| 81 |
|
| 82 |
@spaces.GPU
|
dataset_utils.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
from gen_utils import read_json
|
| 2 |
|
| 3 |
def load_motionfix(path_to_data):
|
| 4 |
-
dataset = read_json(path_to_data + '/
|
| 5 |
-
splits = read_json(path_to_data + '/
|
| 6 |
|
| 7 |
train_data = {}
|
| 8 |
val_data = {}
|
|
|
|
| 1 |
from gen_utils import read_json
|
| 2 |
|
| 3 |
def load_motionfix(path_to_data):
|
| 4 |
+
dataset = read_json(path_to_data + '/amt_motionfix_latest_final.json')
|
| 5 |
+
splits = read_json(path_to_data + '/splits_final.json')
|
| 6 |
|
| 7 |
train_data = {}
|
| 8 |
val_data = {}
|
download_deps.py
CHANGED
|
@@ -12,9 +12,9 @@ def get_smpl_models():
|
|
| 12 |
return snapshot_download(repo_id=REPO_ID, allow_patterns="smplh*",
|
| 13 |
token=access_token_smpl)
|
| 14 |
|
| 15 |
-
def download_models():
|
| 16 |
REPO_ID = 'athn-nik/example-model'
|
| 17 |
-
return hf_hub_download(REPO_ID, filename="
|
| 18 |
|
| 19 |
def download_model_config():
|
| 20 |
REPO_ID = 'athn-nik/example-model'
|
|
|
|
| 12 |
return snapshot_download(repo_id=REPO_ID, allow_patterns="smplh*",
|
| 13 |
token=access_token_smpl)
|
| 14 |
|
| 15 |
+
def download_models(ckpt_to_dl):
|
| 16 |
REPO_ID = 'athn-nik/example-model'
|
| 17 |
+
return hf_hub_download(REPO_ID, filename=f"{ckpt_to_dl}.ckpt")
|
| 18 |
|
| 19 |
def download_model_config():
|
| 20 |
REPO_ID = 'athn-nik/example-model'
|