MeYourHint commited on
Commit
5ac6ee6
β€’
1 Parent(s): 090c3d7

Update stats

Browse files
Files changed (2) hide show
  1. app.py +24 -4
  2. prepare/download_models_demo.sh +2 -1
app.py CHANGED
@@ -34,7 +34,7 @@ from gen_t2m import load_vq_model, load_res_model, load_trans_model, load_len_es
34
 
35
  clip_version = 'ViT-B/32'
36
 
37
- WEBSITE = """
38
  <div class="embed_hidden">
39
  <h1 style='text-align: center'> MoMask: Generative Masked Modeling of 3D Human Motions </h1>
40
  <h2 style='text-align: center'>
@@ -54,6 +54,7 @@ WEBSITE = """
54
  <a target="_blank" href="https://ericguo5513.github.io/source_files/momask_2023_bib.txt"> <button type="button" class="btn btn-primary btn-lg"> BibTex </button></a> &ensp;
55
  <a target="_blank" href="https://huggingface.co/spaces/MeYourHint/MoMask?docker=true" title="Run with docker"> <button type="button" class="btn btn-primary btn-lg"> Docker </button></a> &ensp;
56
  <a target="_blank" href="https://huggingface.co/spaces/MeYourHint/MoMask?duplicate=true" title="Duplicate space with private gpu and no queue"> <button type="button" class="btn btn-primary btn-lg"> Duplicate </button></a>
 
57
  </h3>
58
  <h3> Description </h3>
59
  <p>
@@ -63,7 +64,8 @@ WEBSITE = """
63
  πŸš€πŸš€πŸš€ In addition, we provide a link to download the generated human skeletal motion in <b>BVH</b> file format, compatible with CG software such as Blender!!! πŸš€πŸš€πŸš€
64
  </p>
65
  <p>
66
- 😁😁😁 If you find this demo interesting, we would appreciate your star on our <a href="https://github.com/EricGuo5513/momask-codes" target="_blank">github</a>. More details could be found on our <a href='https://ericguo5513.github.io/momask/' target='_blank'>webpage</a>. 🫢🫢🫢
 
67
  </p>
68
  <p>
69
  If you have any issues on this space or feature requests, we warmly welcome you to contact us through our <a href="https://github.com/EricGuo5513/momask-codes/issues" target="_blank">github repo</a> or <a href="mailto:ymu3@ualberta.ca?subject =[MoMask]Feedback&body = Message">email</a>.
@@ -118,8 +120,23 @@ CSS = """
118
  DEFAULT_TEXT = "A person is "
119
 
120
 
121
- if not os.path.exists("checkpoints/t2m"):
122
  os.system("bash prepare/download_models_demo.sh")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  ##########################
125
  ######Preparing demo######
@@ -186,6 +203,9 @@ def generate(
186
  ):
187
  # fixseed(seed)
188
  print(text)
 
 
 
189
  prompt_list = []
190
  length_list = []
191
  est_length = False
@@ -219,7 +239,7 @@ def generate(
219
  pred_motions = vq_model.forward_decoder(mids)
220
  pred_motions = pred_motions.detach().cpu().numpy()
221
  data = inv_transform(pred_motions)
222
- ruid = random.randrange(99999)
223
  for k, (caption, joint_data) in enumerate(zip(captions, data)):
224
  animation_path = pjoin(cached_dir, f'{uid}')
225
  os.makedirs(animation_path, exist_ok=True)
 
34
 
35
  clip_version = 'ViT-B/32'
36
 
37
+ WEBSITE = f"""
38
  <div class="embed_hidden">
39
  <h1 style='text-align: center'> MoMask: Generative Masked Modeling of 3D Human Motions </h1>
40
  <h2 style='text-align: center'>
 
54
  <a target="_blank" href="https://ericguo5513.github.io/source_files/momask_2023_bib.txt"> <button type="button" class="btn btn-primary btn-lg"> BibTex </button></a> &ensp;
55
  <a target="_blank" href="https://huggingface.co/spaces/MeYourHint/MoMask?docker=true" title="Run with docker"> <button type="button" class="btn btn-primary btn-lg"> Docker </button></a> &ensp;
56
  <a target="_blank" href="https://huggingface.co/spaces/MeYourHint/MoMask?duplicate=true" title="Duplicate space with private gpu and no queue"> <button type="button" class="btn btn-primary btn-lg"> Duplicate </button></a>
57
+ <img src=https://img.shields.io/badge/Visit-{Total_Calls}-green>
58
  </h3>
59
  <h3> Description </h3>
60
  <p>
 
64
  πŸš€πŸš€πŸš€ In addition, we provide a link to download the generated human skeletal motion in <b>BVH</b> file format, compatible with CG software such as Blender!!! πŸš€πŸš€πŸš€
65
  </p>
66
  <p>
67
+ <script async defer src="https://buttons.github.io/buttons.js"></script>
68
+ 😁😁😁 If you find this demo interesting, we would appreciate your star on our <a href="https://github.com/EricGuo5513/momask-codes" target="_blank">github</a> <a class="github-button" href="https://github.com/EricGuo5513/momask-codes" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" data-show-count="true" aria-label="Star EricGuo5513/momask-codes on GitHub">Star</a>. More details could be found on our <a href='https://ericguo5513.github.io/momask/' target='_blank'>webpage</a>. 🫢🫢🫢
69
  </p>
70
  <p>
71
  If you have any issues on this space or feature requests, we warmly welcome you to contact us through our <a href="https://github.com/EricGuo5513/momask-codes/issues" target="_blank">github repo</a> or <a href="mailto:ymu3@ualberta.ca?subject =[MoMask]Feedback&body = Message">email</a>.
 
120
  DEFAULT_TEXT = "A person is "
121
 
122
 
123
+ if not os.path.exists("/data/checkpoints/t2m"):
124
  os.system("bash prepare/download_models_demo.sh")
125
+ if not os.path.exists("checkpoints/t2m"):
126
+ os.system("ln -s /data/checkpoints checkpoints")
127
+ if not os.path.exists("/data/stats"):
128
+ os.makedirs("/data/stats")
129
+ with open("/data/stats/Prompts.text", 'w') as f:
130
+ pass
131
+
132
+ Total_Calls = 0
133
+ def update_total_calls():
134
+ global Total_Calls
135
+ Total_Calls_offset = 4730 ## init number from visit, 01/07
136
+ with open("/data/stats/Prompts.text", 'r') as f:
137
+ Total_Calls = len(f.readlines()) + Total_Calls_offset
138
+
139
+ ### Load Stats ###
140
 
141
  ##########################
142
  ######Preparing demo######
 
203
  ):
204
  # fixseed(seed)
205
  print(text)
206
+ with open("/data/stats/Prompts.text", 'a') as f:
207
+ f.write(text+'\n')
208
+ update_total_calls()
209
  prompt_list = []
210
  length_list = []
211
  est_length = False
 
239
  pred_motions = vq_model.forward_decoder(mids)
240
  pred_motions = pred_motions.detach().cpu().numpy()
241
  data = inv_transform(pred_motions)
242
+ ruid = random.randrange(999999999)
243
  for k, (caption, joint_data) in enumerate(zip(captions, data)):
244
  animation_path = pjoin(cached_dir, f'{uid}')
245
  os.makedirs(animation_path, exist_ok=True)
prepare/download_models_demo.sh CHANGED
@@ -1,3 +1,4 @@
 
1
  rm -rf checkpoints
2
  mkdir checkpoints
3
  cd checkpoints
@@ -7,4 +8,4 @@ echo -e "Downloading pretrained models for HumanML3D dataset"
7
  gdown --fuzzy https://drive.google.com/file/d/1dtKP2xBk-UjG9o16MVfBJDmGNSI56Dch/view?usp=sharing
8
  unzip humanml3d_models.zip
9
  rm humanml3d_models.zip
10
- cd ../../
 
1
+ cd /data
2
  rm -rf checkpoints
3
  mkdir checkpoints
4
  cd checkpoints
 
8
  gdown --fuzzy https://drive.google.com/file/d/1dtKP2xBk-UjG9o16MVfBJDmGNSI56Dch/view?usp=sharing
9
  unzip humanml3d_models.zip
10
  rm humanml3d_models.zip
11
+ cd /home/user/app