rsabathier commited on
Commit
bb74569
·
0 Parent(s):

Initial commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +184 -0
  2. LICENSE.txt +133 -0
  3. README.md +11 -0
  4. app.py +676 -0
  5. assets/camel_demo.glb +3 -0
  6. assets/davis_camel.gif +3 -0
  7. assets/davis_camel/00.png +3 -0
  8. assets/davis_camel/01.png +3 -0
  9. assets/davis_camel/02.png +3 -0
  10. assets/davis_camel/03.png +3 -0
  11. assets/davis_camel/04.png +3 -0
  12. assets/davis_camel/05.png +3 -0
  13. assets/davis_camel/06.png +3 -0
  14. assets/davis_camel/07.png +3 -0
  15. assets/davis_camel/08.png +3 -0
  16. assets/davis_camel/09.png +3 -0
  17. assets/davis_camel/10.png +3 -0
  18. assets/davis_camel/11.png +3 -0
  19. assets/davis_camel/12.png +3 -0
  20. assets/davis_camel/13.png +3 -0
  21. assets/davis_camel/14.png +3 -0
  22. assets/davis_camel/15.png +3 -0
  23. assets/davis_flamingo.gif +3 -0
  24. assets/davis_flamingo/00.png +3 -0
  25. assets/davis_flamingo/01.png +3 -0
  26. assets/davis_flamingo/02.png +3 -0
  27. assets/davis_flamingo/03.png +3 -0
  28. assets/davis_flamingo/04.png +3 -0
  29. assets/davis_flamingo/05.png +3 -0
  30. assets/davis_flamingo/06.png +3 -0
  31. assets/davis_flamingo/07.png +3 -0
  32. assets/davis_flamingo/08.png +3 -0
  33. assets/davis_flamingo/09.png +3 -0
  34. assets/davis_flamingo/10.png +3 -0
  35. assets/davis_flamingo/11.png +3 -0
  36. assets/davis_flamingo/12.png +3 -0
  37. assets/davis_flamingo/13.png +0 -0
  38. assets/davis_flamingo/14.png +0 -0
  39. assets/davis_flamingo/15.png +0 -0
  40. assets/kangaroo.gif +3 -0
  41. assets/kangaroo/00.png +3 -0
  42. assets/kangaroo/01.png +3 -0
  43. assets/kangaroo/02.png +3 -0
  44. assets/kangaroo/03.png +3 -0
  45. assets/kangaroo/04.png +3 -0
  46. assets/kangaroo/05.png +3 -0
  47. assets/kangaroo/06.png +3 -0
  48. assets/kangaroo/07.png +3 -0
  49. assets/kangaroo/08.png +3 -0
  50. assets/kangaroo/09.png +3 -0
.gitattributes ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/docs/teaser.jpg filter=lfs diff=lfs merge=lfs -text
37
+ assets/examples/davis_camel/00.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/examples/davis_camel/01.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/examples/davis_camel/02.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/examples/davis_camel/03.png filter=lfs diff=lfs merge=lfs -text
41
+ assets/examples/davis_camel/04.png filter=lfs diff=lfs merge=lfs -text
42
+ assets/examples/davis_camel/05.png filter=lfs diff=lfs merge=lfs -text
43
+ assets/examples/davis_camel/06.png filter=lfs diff=lfs merge=lfs -text
44
+ assets/examples/davis_camel/07.png filter=lfs diff=lfs merge=lfs -text
45
+ assets/examples/davis_camel/08.png filter=lfs diff=lfs merge=lfs -text
46
+ assets/examples/davis_camel/09.png filter=lfs diff=lfs merge=lfs -text
47
+ assets/examples/davis_camel/10.png filter=lfs diff=lfs merge=lfs -text
48
+ assets/examples/davis_camel/11.png filter=lfs diff=lfs merge=lfs -text
49
+ assets/examples/davis_camel/12.png filter=lfs diff=lfs merge=lfs -text
50
+ assets/examples/davis_camel/13.png filter=lfs diff=lfs merge=lfs -text
51
+ assets/examples/davis_camel/14.png filter=lfs diff=lfs merge=lfs -text
52
+ assets/examples/davis_camel/15.png filter=lfs diff=lfs merge=lfs -text
53
+ assets/examples/davis_camel.gif filter=lfs diff=lfs merge=lfs -text
54
+ assets/examples/davis_flamingo/00.png filter=lfs diff=lfs merge=lfs -text
55
+ assets/examples/davis_flamingo/01.png filter=lfs diff=lfs merge=lfs -text
56
+ assets/examples/davis_flamingo/02.png filter=lfs diff=lfs merge=lfs -text
57
+ assets/examples/davis_flamingo/03.png filter=lfs diff=lfs merge=lfs -text
58
+ assets/examples/davis_flamingo/04.png filter=lfs diff=lfs merge=lfs -text
59
+ assets/examples/davis_flamingo/05.png filter=lfs diff=lfs merge=lfs -text
60
+ assets/examples/davis_flamingo/06.png filter=lfs diff=lfs merge=lfs -text
61
+ assets/examples/davis_flamingo/07.png filter=lfs diff=lfs merge=lfs -text
62
+ assets/examples/davis_flamingo/08.png filter=lfs diff=lfs merge=lfs -text
63
+ assets/examples/davis_flamingo/09.png filter=lfs diff=lfs merge=lfs -text
64
+ assets/examples/davis_flamingo/10.png filter=lfs diff=lfs merge=lfs -text
65
+ assets/examples/davis_flamingo/11.png filter=lfs diff=lfs merge=lfs -text
66
+ assets/examples/davis_flamingo/12.png filter=lfs diff=lfs merge=lfs -text
67
+ assets/examples/davis_flamingo.gif filter=lfs diff=lfs merge=lfs -text
68
+ assets/examples/davis_horse/00.png filter=lfs diff=lfs merge=lfs -text
69
+ assets/examples/davis_horse/01.png filter=lfs diff=lfs merge=lfs -text
70
+ assets/examples/davis_horse/02.png filter=lfs diff=lfs merge=lfs -text
71
+ assets/examples/davis_horse/03.png filter=lfs diff=lfs merge=lfs -text
72
+ assets/examples/davis_horse/04.png filter=lfs diff=lfs merge=lfs -text
73
+ assets/examples/davis_horse/05.png filter=lfs diff=lfs merge=lfs -text
74
+ assets/examples/davis_horse/06.png filter=lfs diff=lfs merge=lfs -text
75
+ assets/examples/davis_horse/07.png filter=lfs diff=lfs merge=lfs -text
76
+ assets/examples/davis_horse/08.png filter=lfs diff=lfs merge=lfs -text
77
+ assets/examples/davis_horse/09.png filter=lfs diff=lfs merge=lfs -text
78
+ assets/examples/davis_horse/10.png filter=lfs diff=lfs merge=lfs -text
79
+ assets/examples/davis_horse/11.png filter=lfs diff=lfs merge=lfs -text
80
+ assets/examples/davis_horse/12.png filter=lfs diff=lfs merge=lfs -text
81
+ assets/examples/davis_horse/13.png filter=lfs diff=lfs merge=lfs -text
82
+ assets/examples/davis_horse/14.png filter=lfs diff=lfs merge=lfs -text
83
+ assets/examples/davis_horse/15.png filter=lfs diff=lfs merge=lfs -text
84
+ assets/examples/davis_horse.gif filter=lfs diff=lfs merge=lfs -text
85
+ assets/examples/kangaroo/00.png filter=lfs diff=lfs merge=lfs -text
86
+ assets/examples/kangaroo/01.png filter=lfs diff=lfs merge=lfs -text
87
+ assets/examples/kangaroo/02.png filter=lfs diff=lfs merge=lfs -text
88
+ assets/examples/kangaroo/03.png filter=lfs diff=lfs merge=lfs -text
89
+ assets/examples/kangaroo/04.png filter=lfs diff=lfs merge=lfs -text
90
+ assets/examples/kangaroo/05.png filter=lfs diff=lfs merge=lfs -text
91
+ assets/examples/kangaroo/06.png filter=lfs diff=lfs merge=lfs -text
92
+ assets/examples/kangaroo/07.png filter=lfs diff=lfs merge=lfs -text
93
+ assets/examples/kangaroo/08.png filter=lfs diff=lfs merge=lfs -text
94
+ assets/examples/kangaroo/09.png filter=lfs diff=lfs merge=lfs -text
95
+ assets/examples/kangaroo/10.png filter=lfs diff=lfs merge=lfs -text
96
+ assets/examples/kangaroo/11.png filter=lfs diff=lfs merge=lfs -text
97
+ assets/examples/kangaroo/12.png filter=lfs diff=lfs merge=lfs -text
98
+ assets/examples/kangaroo/13.png filter=lfs diff=lfs merge=lfs -text
99
+ assets/examples/kangaroo/14.png filter=lfs diff=lfs merge=lfs -text
100
+ assets/examples/kangaroo/15.png filter=lfs diff=lfs merge=lfs -text
101
+ assets/examples/kangaroo.gif filter=lfs diff=lfs merge=lfs -text
102
+ assets/examples/spring/00.png filter=lfs diff=lfs merge=lfs -text
103
+ assets/examples/spring/01.png filter=lfs diff=lfs merge=lfs -text
104
+ assets/examples/spring/02.png filter=lfs diff=lfs merge=lfs -text
105
+ assets/examples/spring/03.png filter=lfs diff=lfs merge=lfs -text
106
+ assets/examples/spring/04.png filter=lfs diff=lfs merge=lfs -text
107
+ assets/examples/spring/05.png filter=lfs diff=lfs merge=lfs -text
108
+ assets/examples/spring/06.png filter=lfs diff=lfs merge=lfs -text
109
+ assets/examples/spring/07.png filter=lfs diff=lfs merge=lfs -text
110
+ assets/examples/spring/08.png filter=lfs diff=lfs merge=lfs -text
111
+ assets/examples/spring/09.png filter=lfs diff=lfs merge=lfs -text
112
+ assets/examples/spring/10.png filter=lfs diff=lfs merge=lfs -text
113
+ assets/examples/spring/11.png filter=lfs diff=lfs merge=lfs -text
114
+ assets/examples/spring/12.png filter=lfs diff=lfs merge=lfs -text
115
+ assets/examples/spring/13.png filter=lfs diff=lfs merge=lfs -text
116
+ assets/examples/spring/14.png filter=lfs diff=lfs merge=lfs -text
117
+ assets/examples/spring/15.png filter=lfs diff=lfs merge=lfs -text
118
+ assets/examples/spring.gif filter=lfs diff=lfs merge=lfs -text
119
+ assets/camel_demo.glb filter=lfs diff=lfs merge=lfs -text
120
+ assets/davis_camel/00.png filter=lfs diff=lfs merge=lfs -text
121
+ assets/davis_camel/01.png filter=lfs diff=lfs merge=lfs -text
122
+ assets/davis_camel/02.png filter=lfs diff=lfs merge=lfs -text
123
+ assets/davis_camel/03.png filter=lfs diff=lfs merge=lfs -text
124
+ assets/davis_camel/04.png filter=lfs diff=lfs merge=lfs -text
125
+ assets/davis_camel/05.png filter=lfs diff=lfs merge=lfs -text
126
+ assets/davis_camel/06.png filter=lfs diff=lfs merge=lfs -text
127
+ assets/davis_camel/07.png filter=lfs diff=lfs merge=lfs -text
128
+ assets/davis_camel/08.png filter=lfs diff=lfs merge=lfs -text
129
+ assets/davis_camel/09.png filter=lfs diff=lfs merge=lfs -text
130
+ assets/davis_camel/10.png filter=lfs diff=lfs merge=lfs -text
131
+ assets/davis_camel/11.png filter=lfs diff=lfs merge=lfs -text
132
+ assets/davis_camel/12.png filter=lfs diff=lfs merge=lfs -text
133
+ assets/davis_camel/13.png filter=lfs diff=lfs merge=lfs -text
134
+ assets/davis_camel/14.png filter=lfs diff=lfs merge=lfs -text
135
+ assets/davis_camel/15.png filter=lfs diff=lfs merge=lfs -text
136
+ assets/davis_camel.gif filter=lfs diff=lfs merge=lfs -text
137
+ assets/davis_flamingo/00.png filter=lfs diff=lfs merge=lfs -text
138
+ assets/davis_flamingo/01.png filter=lfs diff=lfs merge=lfs -text
139
+ assets/davis_flamingo/02.png filter=lfs diff=lfs merge=lfs -text
140
+ assets/davis_flamingo/03.png filter=lfs diff=lfs merge=lfs -text
141
+ assets/davis_flamingo/04.png filter=lfs diff=lfs merge=lfs -text
142
+ assets/davis_flamingo/05.png filter=lfs diff=lfs merge=lfs -text
143
+ assets/davis_flamingo/06.png filter=lfs diff=lfs merge=lfs -text
144
+ assets/davis_flamingo/07.png filter=lfs diff=lfs merge=lfs -text
145
+ assets/davis_flamingo/08.png filter=lfs diff=lfs merge=lfs -text
146
+ assets/davis_flamingo/09.png filter=lfs diff=lfs merge=lfs -text
147
+ assets/davis_flamingo/10.png filter=lfs diff=lfs merge=lfs -text
148
+ assets/davis_flamingo/11.png filter=lfs diff=lfs merge=lfs -text
149
+ assets/davis_flamingo/12.png filter=lfs diff=lfs merge=lfs -text
150
+ assets/davis_flamingo.gif filter=lfs diff=lfs merge=lfs -text
151
+ assets/kangaroo/00.png filter=lfs diff=lfs merge=lfs -text
152
+ assets/kangaroo/01.png filter=lfs diff=lfs merge=lfs -text
153
+ assets/kangaroo/02.png filter=lfs diff=lfs merge=lfs -text
154
+ assets/kangaroo/03.png filter=lfs diff=lfs merge=lfs -text
155
+ assets/kangaroo/04.png filter=lfs diff=lfs merge=lfs -text
156
+ assets/kangaroo/05.png filter=lfs diff=lfs merge=lfs -text
157
+ assets/kangaroo/06.png filter=lfs diff=lfs merge=lfs -text
158
+ assets/kangaroo/07.png filter=lfs diff=lfs merge=lfs -text
159
+ assets/kangaroo/08.png filter=lfs diff=lfs merge=lfs -text
160
+ assets/kangaroo/09.png filter=lfs diff=lfs merge=lfs -text
161
+ assets/kangaroo/10.png filter=lfs diff=lfs merge=lfs -text
162
+ assets/kangaroo/11.png filter=lfs diff=lfs merge=lfs -text
163
+ assets/kangaroo/12.png filter=lfs diff=lfs merge=lfs -text
164
+ assets/kangaroo/13.png filter=lfs diff=lfs merge=lfs -text
165
+ assets/kangaroo/14.png filter=lfs diff=lfs merge=lfs -text
166
+ assets/kangaroo/15.png filter=lfs diff=lfs merge=lfs -text
167
+ assets/kangaroo.gif filter=lfs diff=lfs merge=lfs -text
168
+ assets/spring/00.png filter=lfs diff=lfs merge=lfs -text
169
+ assets/spring/01.png filter=lfs diff=lfs merge=lfs -text
170
+ assets/spring/02.png filter=lfs diff=lfs merge=lfs -text
171
+ assets/spring/03.png filter=lfs diff=lfs merge=lfs -text
172
+ assets/spring/04.png filter=lfs diff=lfs merge=lfs -text
173
+ assets/spring/05.png filter=lfs diff=lfs merge=lfs -text
174
+ assets/spring/06.png filter=lfs diff=lfs merge=lfs -text
175
+ assets/spring/07.png filter=lfs diff=lfs merge=lfs -text
176
+ assets/spring/08.png filter=lfs diff=lfs merge=lfs -text
177
+ assets/spring/09.png filter=lfs diff=lfs merge=lfs -text
178
+ assets/spring/10.png filter=lfs diff=lfs merge=lfs -text
179
+ assets/spring/11.png filter=lfs diff=lfs merge=lfs -text
180
+ assets/spring/12.png filter=lfs diff=lfs merge=lfs -text
181
+ assets/spring/13.png filter=lfs diff=lfs merge=lfs -text
182
+ assets/spring/14.png filter=lfs diff=lfs merge=lfs -text
183
+ assets/spring/15.png filter=lfs diff=lfs merge=lfs -text
184
+ assets/spring.gif filter=lfs diff=lfs merge=lfs -text
LICENSE.txt ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ INSTRUCTIONS FOR USE - NOT FOR INCLUSION IN REPO
2
+ This license should not be modified. If you wish to change terms in the license (e.g., remove the noncommercial provision), please work with your product counsel to determine whether a bespoke, model-specific license is appropriate. Any modified version of this license should have a distinct license name to avoid confusion.
3
+ Confirm with your product counsel (i.e., the legal POC assigned to your RR/OS review) that this license is appropriate for your use-case. This license should be applied where a FAIR team seeks to release a generative model (including Llama derivatives) or model that otherwise requires more robust terms and an AUP (per case-by-case assessment from PXFN).
4
+ Before the license goes live, please add the responsible STOs to the “List of Projects” tab in the FAIR License Tracker. Note, to the extent there is a report of a violation of the FAIR License AUP, the STOs responsible for the model release will be responsible for any required investigation or action.
5
+ Update the “Last Updated” date with the date of the model release.
6
+ *Any release of data, code, or model weights requires documented legal approval.
7
+
8
+ * * *
9
+
10
+ FAIR Noncommercial Research License
11
+ v1 Last Updated: August 18, 2025
12
+
13
+ “Acceptable Use Policy” means the FAIR Acceptable Use Policy, applicable to Research Materials, that is incorporated into this Agreement.
14
+
15
+ “Agreement” means the terms and conditions for use, reproduction, distribution and modification of the Research Materials set forth herein.
16
+
17
+
18
+ “Documentation” means the specifications, manuals and documentation accompanying
19
+ Research Materials distributed by Meta.
20
+
21
+
22
+ “Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
23
+
24
+
25
+ “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
26
+
27
+ “Noncommercial Research Uses” means noncommercial research use cases related to research, development, education, processing, or analysis and in each case, is not primarily intended for commercial advantage or monetary compensation to you or others.
28
+
29
+ “Research Materials” means, collectively, Documentation and the models, software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code, demonstration materials and other elements of the foregoing distributed by Meta and made available under this Agreement.
30
+
31
+ By clicking “I Accept” below or by using or distributing any portion or element of the Research Materials, you agree to be bound by this Agreement.
32
+
33
+
34
+ 1. License Rights and Redistribution.
35
+
36
+
37
+ a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the Research Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Research Materials.
38
+
39
+ b. Redistribution and Use.
40
+ i. You will not use the Research Materials or any outputs or results of the Research Materials in connection with any commercial uses or for any uses other than Noncommercial Research Uses;
41
+
42
+
43
+ ii. Distribution of Research Materials, and any derivative works thereof, are subject to the terms of this Agreement. If you distribute or make the Research Materials, or any derivative works thereof, available to a third party, you may only do so under the terms of this Agreement. You shall also provide a copy of this Agreement to such third party.
44
+
45
+
46
+ iii. If you submit for publication the results of research you perform on, using, or otherwise in connection with Research Materials, you must acknowledge the use of Research Materials in your publication.
47
+
48
+
49
+ iv. Your use of the Research Materials must comply with applicable laws and regulations (including Trade Control Laws) and adhere to the FAIR Acceptable Use Policy, which is hereby incorporated by reference into this Agreement.
50
+ 2. User Support. Your Noncommercial Research Use of the Research Materials is done at your own discretion; Meta does not process any information nor provide any service in relation to such use. Meta is under no obligation to provide any support services for the Research Materials. Any support provided is “as is”, “with all faults”, and without warranty of any kind.
51
+
52
+
53
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE RESEARCH MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE RESEARCH MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE RESEARCH MATERIALS AND ANY OUTPUT AND RESULTS.
54
+
55
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT OR INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
56
+
57
+ 5. Intellectual Property.
58
+
59
+
60
+ a. Subject to Meta’s ownership of Research Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the Research Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.
61
+
62
+ b. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Research Materials, outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the Research Materials.
63
+
64
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Research Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the Research Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
65
+
66
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.
67
+
68
+
69
+ 8. Modifications and Amendments. Meta may modify this Agreement from time to time; provided that they are similar in spirit to the current version of the Agreement, but may differ in detail to address new problems or concerns. All such changes will be effective immediately. Your continued use of the Research Materials after any modification to this Agreement constitutes your agreement to such modification. Except as provided in this Agreement, no modification or addition to any provision of this Agreement will be binding unless it is in writing and signed by an authorized representative of both you and Meta.
70
+
71
+
72
+ FAIR Acceptable Use Policy
73
+
74
+ The Fundamental AI Research (FAIR) team at Meta seeks to further understanding of new and existing research domains with the mission of advancing the state-of-the-art in artificial intelligence through open research for the benefit of all.
75
+
76
+ As part of this mission, Meta makes certain research materials available for noncommercial research use. Meta is committed to promoting the safe and responsible use of such research materials.
77
+
78
+ Prohibited Uses
79
+
80
+ You agree you will not use, or allow others to use, Research Materials to:
81
+
82
+ Violate the law or others’ rights, including to:
83
+ Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
84
+ Violence or terrorism
85
+ Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
86
+ Human trafficking, exploitation, and sexual violence
87
+ The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
88
+ Sexual solicitation
89
+ Any other criminal activity
90
+
91
+ Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
92
+
93
+ Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
94
+
95
+ Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
96
+
97
+ Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
98
+
99
+ Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any technology using FAIR research materials
100
+
101
+ Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
102
+
103
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of research artifacts related to the following:
104
+
105
+ Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
106
+
107
+ Guns and illegal weapons (including weapon development)
108
+
109
+ Illegal drugs and regulated/controlled substances
110
+
111
+ Operation of critical infrastructure, transportation technologies, or heavy machinery
112
+
113
+ Self-harm or harm to others, including suicide, cutting, and eating disorders
114
+
115
+ Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
116
+
117
+ 3. Intentionally deceive or mislead others, including use of FAIR Research Materials related to the following:
118
+
119
+ Generating, promoting, or furthering fraud or the creation or promotion of disinformation
120
+
121
+ Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
122
+
123
+ Generating, promoting, or further distributing spam
124
+
125
+ Impersonating another individual without consent, authorization, or legal right
126
+
127
+ Representing that outputs of FAIR research materials or outputs from technology using FAIR research materials are human-generated
128
+
129
+ Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
130
+
131
+ 4. Fail to appropriately disclose to end users any known dangers of your Research Materials.
132
+
133
+ Please report any violation of this Policy or other problems that could lead to a violation of this Policy by submitting a report here [https://docs.google.com/forms/d/e/1FAIpQLSeb11cryAopJ7LNrC4nxEUXrHY26hfkXQMf_uH-oFgA3WlYZQ/viewform].
README.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ActionMesh
3
+ emoji: 🎬
4
+ colorFrom: purple
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 6.3.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: other
11
+ ---
app.py ADDED
@@ -0,0 +1,676 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ActionMesh Gradio Demo
3
+
4
+ A complete demo for video-to-4D mesh generation using ActionMesh.
5
+ Input: Video file or list of images
6
+ Output: Animated GLB mesh with shape key animation
7
+ """
8
+
9
+ import glob
10
+ import logging
11
+ import os
12
+ import shutil
13
+ import subprocess
14
+ import sys
15
+ import tempfile
16
+ from pathlib import Path
17
+
18
+ import gradio as gr
19
+ import spaces
20
+ import torch
21
+
22
+ # Configure logging for actionmesh modules
23
+ logging.basicConfig(
24
+ level=logging.INFO,
25
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
26
+ )
27
+ logger = logging.getLogger(__name__)
28
+
29
+
30
+ # Path to examples directory
31
+ EXAMPLES_DIR = Path(__file__).parent / "assets"
32
+
33
+
34
+ # --- Setup functions ---
35
+ def setup_blender() -> Path:
36
+ """
37
+ Download and setup Blender 3.5.1 for Linux x64.
38
+
39
+ Downloads Blender from the official release page if not already present,
40
+ extracts it, and returns the path to the blender executable.
41
+
42
+ Returns:
43
+ Path to the blender executable.
44
+ """
45
+ import tarfile
46
+ import urllib.request
47
+
48
+ # Define paths
49
+ repo_dir = Path(__file__).parent.parent
50
+ third_party_dir = repo_dir / "third_party"
51
+ blender_archive = third_party_dir / "blender-3.5.1-linux-x64.tar.xz"
52
+ blender_dir = third_party_dir / "blender-3.5.1-linux-x64"
53
+ blender_executable = blender_dir / "blender"
54
+
55
+ # Create third_party directory if it doesn't exist
56
+ third_party_dir.mkdir(parents=True, exist_ok=True)
57
+
58
+ # Check if Blender is already installed
59
+ if blender_executable.exists():
60
+ print(f"Blender already installed at {blender_executable}")
61
+ return blender_executable
62
+
63
+ # Download URL
64
+ blender_url = (
65
+ "https://download.blender.org/release/Blender3.5/"
66
+ "blender-3.5.1-linux-x64.tar.xz"
67
+ )
68
+
69
+ # Download Blender if archive doesn't exist
70
+ if not blender_archive.exists():
71
+ print(f"Downloading Blender from {blender_url}...")
72
+ try:
73
+ urllib.request.urlretrieve(blender_url, blender_archive)
74
+ print("Blender downloaded successfully.")
75
+ except Exception as e:
76
+ raise RuntimeError(f"Failed to download Blender: {e}")
77
+
78
+ # Extract the archive
79
+ print(f"Extracting Blender to {third_party_dir}...")
80
+ try:
81
+ with tarfile.open(blender_archive, "r:xz") as tar:
82
+ tar.extractall(path=third_party_dir)
83
+ print("Blender extracted successfully.")
84
+ except Exception as e:
85
+ # Clean up partial extraction
86
+ if blender_dir.exists():
87
+ shutil.rmtree(blender_dir)
88
+ raise RuntimeError(f"Failed to extract Blender: {e}")
89
+
90
+ # Optionally remove the archive to save space
91
+ if blender_archive.exists():
92
+ blender_archive.unlink()
93
+ print("Removed Blender archive to save space.")
94
+
95
+ # Verify installation
96
+ if not blender_executable.exists():
97
+ raise RuntimeError(
98
+ f"Blender executable not found at expected path: " f"{blender_executable}"
99
+ )
100
+
101
+ print(f"Blender installed successfully at {blender_executable}")
102
+ return blender_executable
103
+
104
+
105
+ def setup_actionmesh():
106
+ """Clone and install ActionMesh if not already installed."""
107
+ cache_dir = Path.home() / ".cache" / "actionmesh"
108
+
109
+ try:
110
+ import actionmesh
111
+
112
+ print("ActionMesh already installed.")
113
+ # Still need to add paths for current process
114
+ actionmesh_path = str(cache_dir.resolve())
115
+ if actionmesh_path not in sys.path:
116
+ sys.path.insert(0, actionmesh_path)
117
+ triposg_path = str((cache_dir / "third_party" / "TripoSG").resolve())
118
+ if triposg_path not in sys.path:
119
+ sys.path.insert(0, triposg_path)
120
+ return cache_dir
121
+ except ImportError:
122
+ pass
123
+
124
+ print("Cloning ActionMesh...")
125
+ if cache_dir.exists():
126
+ shutil.rmtree(cache_dir)
127
+ cache_dir.parent.mkdir(parents=True, exist_ok=True)
128
+
129
+ subprocess.run(
130
+ [
131
+ "git",
132
+ "clone",
133
+ "https://github.com/facebookresearch/actionmesh.git",
134
+ str(cache_dir),
135
+ ],
136
+ check=True,
137
+ )
138
+ print("ActionMesh cloned successfully.")
139
+
140
+ # Configure git to use HTTPS instead of SSH (for submodules)
141
+ subprocess.run(
142
+ [
143
+ "git",
144
+ "config",
145
+ "--global",
146
+ "url.https://github.com/.insteadOf",
147
+ "git@github.com:",
148
+ ],
149
+ check=True,
150
+ )
151
+
152
+ # Initialize submodules
153
+ print("Initializing submodules...")
154
+ subprocess.run(
155
+ ["git", "submodule", "update", "--init", "--recursive"],
156
+ cwd=cache_dir,
157
+ check=True,
158
+ )
159
+ print("Submodules initialized successfully.")
160
+
161
+ # Install actionmesh in editable mode (ignore Python version requirement)
162
+ print("Installing ActionMesh...")
163
+ subprocess.run(
164
+ [sys.executable, "-m", "pip", "install", "-e", ".", "--ignore-requires-python"],
165
+ cwd=cache_dir,
166
+ check=True,
167
+ )
168
+ print("ActionMesh installed successfully.")
169
+
170
+ # Add actionmesh to Python path for current process
171
+ actionmesh_path = str(cache_dir.resolve())
172
+ if actionmesh_path not in sys.path:
173
+ sys.path.insert(0, actionmesh_path)
174
+
175
+ # Add TripoSG (submodule) to Python path for current process
176
+ triposg_path = str((cache_dir / "third_party" / "TripoSG").resolve())
177
+ if triposg_path not in sys.path:
178
+ sys.path.insert(0, triposg_path)
179
+
180
+ return cache_dir
181
+
182
+
183
+ def setup_environment():
184
+ """Setup the complete environment for ActionMesh."""
185
+ print("=" * 50)
186
+ print("Setting up ActionMesh environment...")
187
+ print("=" * 50)
188
+
189
+ # Clone and install ActionMesh if needed
190
+ setup_actionmesh()
191
+ blender_path = setup_blender()
192
+
193
+ print("=" * 50)
194
+ print("Environment setup complete!")
195
+ print("=" * 50)
196
+ return blender_path
197
+
198
+
199
+ # Run setup on import
200
+ blender_path = setup_environment()
201
+
202
+
203
+ from actionmesh.io.glb_export import create_animated_glb
204
+ from actionmesh.io.mesh_io import save_deformation
205
+
206
+ # --- Import ActionMesh modules after setup ---
207
+ from actionmesh.io.video_input import load_frames
208
+ from actionmesh.pipeline import ActionMeshPipeline
209
+ from actionmesh.render.utils import save_rgba_video
210
+
211
+ # Global pipeline instance (loaded on CPU at startup)
212
+ pipeline: ActionMeshPipeline | None = None
213
+
214
+
215
+ def get_available_examples() -> list[tuple[str, str]]:
216
+ """
217
+ Get available examples from the assets directory.
218
+
219
+ Returns:
220
+ List of tuples (display_name, example_dir_path) for each example.
221
+ """
222
+ examples = []
223
+ if EXAMPLES_DIR.exists():
224
+ for example_dir in sorted(EXAMPLES_DIR.iterdir()):
225
+ if example_dir.is_dir():
226
+ # Get the first image as a thumbnail
227
+ images = sorted(glob.glob(str(example_dir / "*.png")))
228
+ if images:
229
+ display_name = example_dir.name.replace("_", " ").title()
230
+ examples.append((display_name, str(example_dir)))
231
+ return examples
232
+
233
+
234
+ def get_example_thumbnails() -> list[str]:
235
+ """
236
+ Get thumbnail images/GIFs for all available examples.
237
+
238
+ Looks for a GIF file named "{folder_name}.gif" in the same parent directory
239
+ as the example folder. Falls back to the first PNG image if no GIF is found.
240
+
241
+ Returns:
242
+ List of paths to the GIF or first image of each example.
243
+ """
244
+ thumbnails = []
245
+ if EXAMPLES_DIR.exists():
246
+ for example_dir in sorted(EXAMPLES_DIR.iterdir()):
247
+ if example_dir.is_dir():
248
+ # Try to find a GIF with the same name as the folder
249
+ gif_path = example_dir.parent / f"{example_dir.name}.gif"
250
+ if gif_path.exists():
251
+ thumbnails.append(str(gif_path))
252
+ else:
253
+ # Fall back to first PNG image
254
+ images = sorted(glob.glob(str(example_dir / "*.png")))
255
+ if images:
256
+ thumbnails.append(images[0])
257
+ return thumbnails
258
+
259
+
260
+ def load_example_images(evt: gr.SelectData) -> list[str]:
261
+ """
262
+ Load images from the selected example.
263
+
264
+ Args:
265
+ evt: Gradio SelectData event containing the selected index.
266
+
267
+ Returns:
268
+ List of image paths from the selected example.
269
+ """
270
+ examples = get_available_examples()
271
+ if evt.index < len(examples):
272
+ _, example_dir = examples[evt.index]
273
+ images = sorted(glob.glob(os.path.join(example_dir, "*.png")))
274
+ return images
275
+ return []
276
+
277
+
278
+ def load_pipeline_cpu() -> ActionMeshPipeline:
279
+ """Load the ActionMesh pipeline on CPU (called once at module load)."""
280
+ global pipeline
281
+ if pipeline is None:
282
+ print("Loading ActionMesh pipeline on CPU...")
283
+ # Get config path from actionmesh cache directory
284
+ cache_dir = Path.home() / ".cache" / "actionmesh"
285
+ config_dir = str(cache_dir / "actionmesh" / "configs")
286
+ pipeline = ActionMeshPipeline(
287
+ config_name="actionmesh.yaml",
288
+ config_dir=config_dir,
289
+ )
290
+ print("Pipeline loaded on CPU successfully.")
291
+ return pipeline
292
+
293
+
294
+ # Initialize pipeline on CPU at module load (outside GPU time)
295
+ print("Initializing pipeline on CPU...")
296
+ load_pipeline_cpu()
297
+ print("Pipeline ready (on CPU).")
298
+
299
+
300
+ def _run_actionmesh_impl(
301
+ video_input: str | None,
302
+ image_files: list[str] | None,
303
+ seed: int,
304
+ reference_frame: int,
305
+ quality_mode: str,
306
+ progress: gr.Progress = gr.Progress(),
307
+ ) -> tuple[str | None, str | None, str | None, str]:
308
+ """
309
+ Internal implementation of ActionMesh pipeline.
310
+
311
+ Args:
312
+ video_input: Path to input video file.
313
+ image_files: List of paths to input image files.
314
+ seed: Random seed for generation.
315
+ reference_frame: Reference frame index (1-indexed).
316
+ quality_mode: Quality mode string.
317
+ progress: Gradio progress tracker.
318
+
319
+ Returns:
320
+ Tuple of (animated_glb_path, animated_glb_path, input_video_path, status_message)
321
+ """
322
+ # Create temporary output directory
323
+ output_dir = tempfile.mkdtemp(prefix="actionmesh_")
324
+
325
+ try:
326
+ # Determine input source
327
+ progress(0.1, desc="Loading input...")
328
+
329
+ if video_input is not None:
330
+ input_path = video_input
331
+ elif image_files is not None and len(image_files) > 0:
332
+ # Create temp directory with images
333
+ img_dir = os.path.join(output_dir, "input_images")
334
+ os.makedirs(img_dir, exist_ok=True)
335
+ for i, img_path in enumerate(image_files):
336
+ ext = Path(img_path).suffix
337
+ shutil.copy(img_path, os.path.join(img_dir, f"{i:04d}{ext}"))
338
+ input_path = img_dir
339
+ else:
340
+ return None, None, None, "Error: Please provide a video or images."
341
+
342
+ # Load input
343
+ input_data = load_frames(path=input_path, max_frames=16)
344
+
345
+ if input_data.n_frames < 16:
346
+ return None, None, None, "Error: At least 16 frames are required."
347
+
348
+ # Get pipeline and move to GPU
349
+ progress(0.2, desc="Moving pipeline to GPU...")
350
+ pipe = load_pipeline_cpu()
351
+ pipe.to("cuda")
352
+
353
+ # Clear GPU cache before inference
354
+ if torch.cuda.is_available():
355
+ torch.cuda.empty_cache()
356
+
357
+ # Run inference
358
+ progress(0.3, desc="Running ActionMesh inference...")
359
+
360
+ # Set steps based on quality mode
361
+ if quality_mode == "⚡ Fast":
362
+ stage_0_steps = 50
363
+ stage_1_steps = 15
364
+ else: # High Quality
365
+ stage_0_steps = 100
366
+ stage_1_steps = 30
367
+
368
+ meshes = pipe(
369
+ input=input_data,
370
+ anchor_idx=reference_frame - 1, # Convert from 1-indexed UI to 0-indexed
371
+ stage_0_steps=stage_0_steps,
372
+ stage_1_steps=stage_1_steps,
373
+ seed=seed,
374
+ )
375
+
376
+ # Save input video
377
+ input_video_path = f"{output_dir}/input_video.mp4"
378
+ save_rgba_video(input_data.frames, output_path=input_video_path)
379
+
380
+ if not meshes:
381
+ return None, None, None, "Error: No meshes generated."
382
+
383
+ # Save deformations and create animated GLB
384
+ progress(0.9, desc="Creating animated GLB...")
385
+
386
+ vertices_path, faces_path = save_deformation(
387
+ meshes, path=f"{output_dir}/deformations"
388
+ )
389
+ animated_glb_path = f"{output_dir}/animated_mesh.glb"
390
+ create_animated_glb(
391
+ blender_path=blender_path,
392
+ vertices_npy=vertices_path,
393
+ faces_npy=faces_path,
394
+ output_glb=animated_glb_path,
395
+ fps=8,
396
+ )
397
+
398
+ progress(1.0, desc="Done!")
399
+ status = f"Success! Generated animated mesh with {len(meshes)} frames."
400
+
401
+ return animated_glb_path, animated_glb_path, input_video_path, status
402
+
403
+ except Exception as e:
404
+ return None, None, None, f"Error: {str(e)}"
405
+
406
+
407
+ @spaces.GPU(duration=120)
408
+ @torch.no_grad()
409
+ def _run_actionmesh_fast(
410
+ video_input: str | None,
411
+ image_files: list[str] | None,
412
+ seed: int,
413
+ reference_frame: int,
414
+ quality_mode: str,
415
+ progress: gr.Progress = gr.Progress(),
416
+ ) -> tuple[str | None, str | None, str | None, str]:
417
+ """Fast mode wrapper with 120s GPU duration."""
418
+ return _run_actionmesh_impl(
419
+ video_input, image_files, seed, reference_frame, quality_mode, progress
420
+ )
421
+
422
+
423
+ @spaces.GPU(duration=240)
424
+ @torch.no_grad()
425
+ def _run_actionmesh_hq(
426
+ video_input: str | None,
427
+ image_files: list[str] | None,
428
+ seed: int,
429
+ reference_frame: int,
430
+ quality_mode: str,
431
+ progress: gr.Progress = gr.Progress(),
432
+ ) -> tuple[str | None, str | None, str | None, str]:
433
+ """High quality mode wrapper with 260s GPU duration."""
434
+ return _run_actionmesh_impl(
435
+ video_input, image_files, seed, reference_frame, quality_mode, progress
436
+ )
437
+
438
+
439
+ def run_actionmesh(
440
+ video_input: str | None,
441
+ image_files: list[str] | None,
442
+ seed: int,
443
+ reference_frame: int,
444
+ quality_mode: str,
445
+ progress: gr.Progress = gr.Progress(),
446
+ ) -> tuple[str | None, str | None, str | None, str]:
447
+ """
448
+ Run ActionMesh pipeline on input video or images.
449
+
450
+ Dispatches to the appropriate GPU-decorated function based on quality mode.
451
+
452
+ Args:
453
+ video_input: Path to input video file.
454
+ image_files: List of paths to input image files.
455
+ seed: Random seed for generation.
456
+ reference_frame: Reference frame index (1-indexed).
457
+ quality_mode: Quality mode string.
458
+ progress: Gradio progress tracker.
459
+
460
+ Returns:
461
+ Tuple of (animated_glb_path, animated_glb_path, input_video_path, status_message)
462
+ """
463
+ if quality_mode == "⚡ Fast":
464
+ return _run_actionmesh_fast(
465
+ video_input, image_files, seed, reference_frame, quality_mode, progress
466
+ )
467
+ else:
468
+ return _run_actionmesh_hq(
469
+ video_input, image_files, seed, reference_frame, quality_mode, progress
470
+ )
471
+
472
+
473
+ def create_demo() -> gr.Blocks:
474
+ """Create the Gradio demo interface."""
475
+
476
+ with gr.Blocks(
477
+ title="ActionMesh - Video to 4D Mesh",
478
+ theme=gr.themes.Soft(),
479
+ ) as demo:
480
+
481
+ gr.Markdown(
482
+ """
483
+ # 🎬 ActionMesh: Video to Animated 3D Mesh
484
+
485
+ [**Project Page**](https://remysabathier.github.io/actionmesh/) · [**GitHub**](https://github.com/facebookresearch/ActionMesh)
486
+ [Remy Sabathier](https://www.linkedin.com/in/r%C3%A9my-sabathier-97b264179/), [David Novotny](https://d-novotny.github.io/), [Niloy J. Mitra](http://www0.cs.ucl.ac.uk/staff/n.mitra/), [Tom Monnier](https://tmonnier.com/)
487
+ **[Meta Reality Labs](https://ai.facebook.com/research/)** · **[SpAItial](https://www.spaitial.ai/)** · **[University College London](https://geometry.cs.ucl.ac.uk/)**
488
+
489
+ Generate animated 3D meshes from video input using ActionMesh.
490
+
491
+ **Instructions:**
492
+ 1. Upload a video OR multiple images ⚠️ *Input is limited to exactly 16 frames. Extra frames will be discarded.*
493
+ 2. Click "Generate"
494
+ 3. View the animated 4D mesh in the viewer
495
+ 4. Download the animated GLB mesh (ready for Blender)
496
+
497
+ ⏱️ **Performance:** Inference on HuggingFace Space (ZeroGPU) is 2x slower than running locally.
498
+ We recommend **Fast mode** (90s). For faster inference, run [locally via GitHub](https://github.com/facebookresearch/ActionMesh).
499
+ """
500
+ )
501
+
502
+ with gr.Row():
503
+ with gr.Column(scale=1):
504
+ gr.Markdown("### Input")
505
+
506
+ gr.Markdown(
507
+ """
508
+ ℹ️ **Input should have a uniform background**.
509
+ See our [SAM2 tutorial](https://github.com/facebookresearch/actionmesh/blob/main/assets/docs/sam2_extraction_guide.md) to preprocess any video with background removal.
510
+ """
511
+ )
512
+
513
+ with gr.Tab("Video"):
514
+ video_input = gr.Video(
515
+ label="Upload Video",
516
+ sources=["upload"],
517
+ )
518
+
519
+ with gr.Tab("Images"):
520
+ image_input = gr.File(
521
+ label="Upload Images (multiple frames)",
522
+ file_count="multiple",
523
+ file_types=["image"],
524
+ )
525
+
526
+ # Examples gallery
527
+ example_thumbnails = get_example_thumbnails()
528
+ if example_thumbnails:
529
+ gr.Markdown("### 📁 Example videos")
530
+ gr.Markdown("*Click a video example to load it*")
531
+ example_labels = [e[0] for e in get_available_examples()]
532
+ examples_gallery = gr.Gallery(
533
+ value=[
534
+ (thumb, label)
535
+ for thumb, label in zip(example_thumbnails, example_labels)
536
+ ],
537
+ columns=3,
538
+ rows=2,
539
+ height=350,
540
+ allow_preview=False,
541
+ object_fit="cover",
542
+ )
543
+
544
+ gr.Markdown("### Parameters")
545
+
546
+ quality_mode = gr.Radio(
547
+ label="Generation Mode",
548
+ choices=["⚡ Fast", "✨ High Quality"],
549
+ value="⚡ Fast",
550
+ interactive=True,
551
+ info="⚡ Fast: ~90s, ✨ High Quality: ~3min30s",
552
+ )
553
+
554
+ reference_frame = gr.Slider(
555
+ minimum=1,
556
+ maximum=16,
557
+ value=1,
558
+ step=1,
559
+ label="Reference Frame",
560
+ info="Frame used as reference for 3D generation (1 recommended)",
561
+ )
562
+
563
+ seed = gr.Slider(
564
+ minimum=0,
565
+ maximum=100,
566
+ value=44,
567
+ step=1,
568
+ label="Random Seed",
569
+ )
570
+
571
+ generate_btn = gr.Button("🎬 Generate", variant="primary", size="lg")
572
+
573
+ with gr.Column(scale=2):
574
+ gr.Markdown("### Output")
575
+
576
+ status_text = gr.Textbox(
577
+ label="Status",
578
+ interactive=False,
579
+ value="Ready",
580
+ lines=2,
581
+ )
582
+
583
+ gr.Markdown("### 4D Viewer")
584
+
585
+ # Toggle between input video and 4D mesh viewer
586
+ viewer_toggle = gr.Radio(
587
+ label="Display Mode",
588
+ choices=["4D Mesh Viewer", "Input Video"],
589
+ value="4D Mesh Viewer",
590
+ interactive=True,
591
+ )
592
+
593
+ # 4D mesh display showing animated GLB
594
+ mesh_display = gr.Model3D(
595
+ label="4D Mesh Viewer",
596
+ clear_color=[0.9, 0.9, 0.9, 1.0],
597
+ height=500,
598
+ visible=True,
599
+ )
600
+
601
+ # Input video display
602
+ input_video_display = gr.Video(
603
+ label="Input Video",
604
+ height=500,
605
+ visible=False,
606
+ interactive=False,
607
+ )
608
+
609
+ # Interaction legend for 3D viewer
610
+ gr.Markdown(
611
+ """
612
+ <div style="background: #2d3748; padding: 8px 12px; border-radius: 6px; font-size: 0.85em; color: #e2e8f0;">
613
+ 🖱️ <b>Drag</b> to rotate · <b>Scroll</b> to zoom · <b>Right-click drag</b> to pan
614
+ </div>
615
+ """,
616
+ visible=True,
617
+ )
618
+
619
+ # Download button for the animated GLB
620
+ download_glb = gr.DownloadButton(
621
+ label="Download Animated GLB",
622
+ visible=True,
623
+ )
624
+
625
+ # State to store input video path
626
+ input_video_state = gr.State(value=None)
627
+
628
+ # Toggle handler to switch between mesh viewer and input video
629
+ def toggle_display(choice: str, video_path: str | None):
630
+ if choice == "4D Mesh Viewer":
631
+ return gr.update(visible=True), gr.update(visible=False)
632
+ else:
633
+ return gr.update(visible=False), gr.update(
634
+ visible=True, value=video_path
635
+ )
636
+
637
+ viewer_toggle.change(
638
+ fn=toggle_display,
639
+ inputs=[viewer_toggle, input_video_state],
640
+ outputs=[mesh_display, input_video_display],
641
+ )
642
+
643
+ # Generate button click - runs pipeline and shows animated GLB
644
+ generate_btn.click(
645
+ fn=run_actionmesh,
646
+ inputs=[video_input, image_input, seed, reference_frame, quality_mode],
647
+ outputs=[
648
+ mesh_display,
649
+ download_glb,
650
+ input_video_state,
651
+ status_text,
652
+ ],
653
+ )
654
+
655
+ # Example gallery click - loads example images into the image input
656
+ if example_thumbnails:
657
+ examples_gallery.select(
658
+ fn=load_example_images,
659
+ inputs=None,
660
+ outputs=image_input,
661
+ )
662
+
663
+ gr.Markdown(
664
+ """
665
+ ---
666
+ **Note:** This demo requires a GPU with sufficient VRAM.
667
+ """
668
+ )
669
+
670
+ return demo
671
+
672
+
673
+ if __name__ == "__main__":
674
+ demo = create_demo()
675
+ demo.queue()
676
+ demo.launch(share=True)
assets/camel_demo.glb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a40f4afc9375854179f8816ef5cc1af654e3e100d68da671cb3caaabe98d8660
3
+ size 4066872
assets/davis_camel.gif ADDED

Git LFS Details

  • SHA256: 06e600c62ab41c4993e4a8d7b274e74107b606075fdeff2712664e387a6f8d0b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB
assets/davis_camel/00.png ADDED

Git LFS Details

  • SHA256: d559a0a56a01a99d811841186ef2f0985181d990d65ee51203b41d0356ae465c
  • Pointer size: 131 Bytes
  • Size of remote file: 188 kB
assets/davis_camel/01.png ADDED

Git LFS Details

  • SHA256: 166a2fb94e25522ba2d3522c50da9b163519a141e8813ca2d19e1a09d86b5fc0
  • Pointer size: 131 Bytes
  • Size of remote file: 186 kB
assets/davis_camel/02.png ADDED

Git LFS Details

  • SHA256: 585e36ce0c230ef41d2057a5e0425ab60e47e5cfda6fd73149c9dbf8fed46ac6
  • Pointer size: 131 Bytes
  • Size of remote file: 187 kB
assets/davis_camel/03.png ADDED

Git LFS Details

  • SHA256: cdcdf2e031769956b8fd9d535cebcab1464c051318a5d0bc75ce762b67225238
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
assets/davis_camel/04.png ADDED

Git LFS Details

  • SHA256: 22c031043d191e9204764f55df2b531f35f511927d52df85adbb8ea7d7c29cd9
  • Pointer size: 131 Bytes
  • Size of remote file: 186 kB
assets/davis_camel/05.png ADDED

Git LFS Details

  • SHA256: 8d509c15a4562408a0c2ab702c72f7735f71ceab5d72c3a2639b9e450437c41f
  • Pointer size: 131 Bytes
  • Size of remote file: 186 kB
assets/davis_camel/06.png ADDED

Git LFS Details

  • SHA256: a33badab1ff249dbc8172713abd9e6bdcd84c017e12692eb184acf8c79d209d1
  • Pointer size: 131 Bytes
  • Size of remote file: 184 kB
assets/davis_camel/07.png ADDED

Git LFS Details

  • SHA256: 98be3e88d250e7f77c68078328853ecbc34fb8a64d354ec1b66568dc43424d3e
  • Pointer size: 131 Bytes
  • Size of remote file: 180 kB
assets/davis_camel/08.png ADDED

Git LFS Details

  • SHA256: 5a601fd56a07f4528877dac9b9cdbf0fc434450137d4a7090c074440bc63fdad
  • Pointer size: 131 Bytes
  • Size of remote file: 180 kB
assets/davis_camel/09.png ADDED

Git LFS Details

  • SHA256: 9e63c2c5332f45e4b20b76bfd160c34c15b52a391bae9ae55f9c8b7bdcc1c7ee
  • Pointer size: 131 Bytes
  • Size of remote file: 179 kB
assets/davis_camel/10.png ADDED

Git LFS Details

  • SHA256: 6cb72d2e2fc7a47b71dc6ff7748165701f9964c6c2adce417a2b28c0d76ccf4f
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB
assets/davis_camel/11.png ADDED

Git LFS Details

  • SHA256: 2bb017377e89ab8302bed98838b8db279205d4cf2777eb62510ede28780ccde6
  • Pointer size: 131 Bytes
  • Size of remote file: 179 kB
assets/davis_camel/12.png ADDED

Git LFS Details

  • SHA256: 2d7b1184b0ff89e5377bb577b8adde28d1d4b4ace6dde03492ef6d7f5e21cead
  • Pointer size: 131 Bytes
  • Size of remote file: 180 kB
assets/davis_camel/13.png ADDED

Git LFS Details

  • SHA256: fd6992ae15dc59011fdb8fbd4b10e9eb744a0154b40d09e44ba5c68fa4011001
  • Pointer size: 131 Bytes
  • Size of remote file: 177 kB
assets/davis_camel/14.png ADDED

Git LFS Details

  • SHA256: 7e5414326ca110166764dfc5b928eecd2856de496d15556dad251180e9cc807a
  • Pointer size: 131 Bytes
  • Size of remote file: 177 kB
assets/davis_camel/15.png ADDED

Git LFS Details

  • SHA256: 52a2edb20f050002d1b2532f6e0866d881d0da90ca3f61633088e3f4e40b4ffe
  • Pointer size: 131 Bytes
  • Size of remote file: 180 kB
assets/davis_flamingo.gif ADDED

Git LFS Details

  • SHA256: 4f4b909c60f4218fb4efeb30a56cca08fca993f2c92d1f70b79876680014cbb8
  • Pointer size: 131 Bytes
  • Size of remote file: 526 kB
assets/davis_flamingo/00.png ADDED

Git LFS Details

  • SHA256: 2b824c98e31aa88062637262bb4dd416248cf4f227fdb28928791065973e6631
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
assets/davis_flamingo/01.png ADDED

Git LFS Details

  • SHA256: 4806a302eb1d38d3e01af04fb2d7df9b7009f89779a704d71888b0cc2e7daa07
  • Pointer size: 131 Bytes
  • Size of remote file: 104 kB
assets/davis_flamingo/02.png ADDED

Git LFS Details

  • SHA256: be83449244a408fb44a7a5f04513f0f65614a386fa65d890abeb68989cc870e1
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
assets/davis_flamingo/03.png ADDED

Git LFS Details

  • SHA256: d9c87798e1557b3e35576335f75c7e5219a6099f10ca8b95561849fe49833f3c
  • Pointer size: 131 Bytes
  • Size of remote file: 106 kB
assets/davis_flamingo/04.png ADDED

Git LFS Details

  • SHA256: 75f9a3c3a19342447d3ad9eabd5a54bc41ad0d227164bac3eb21e836f8252bb7
  • Pointer size: 131 Bytes
  • Size of remote file: 104 kB
assets/davis_flamingo/05.png ADDED

Git LFS Details

  • SHA256: 243a55dff277ec4e37049ba8f544c1241d48b4ab088d9af563af23f01b116595
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
assets/davis_flamingo/06.png ADDED

Git LFS Details

  • SHA256: 679993ae3684d3aec44789c810f75bd6da88011f6c25de5814b7411417a38d6e
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB
assets/davis_flamingo/07.png ADDED

Git LFS Details

  • SHA256: 67af8ff0c30479d06219a816c5199c4da17d601cdfd7e26a35292649b8a50a21
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB
assets/davis_flamingo/08.png ADDED

Git LFS Details

  • SHA256: 81dfa736b5d3bc0d78457edbf4777362de5fbd3a999ac5f35b5cf469325853b8
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB
assets/davis_flamingo/09.png ADDED

Git LFS Details

  • SHA256: cb2e132146d83c3053488085d41e90ae420b14df8618ce36b0eb61c6582a1f92
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB
assets/davis_flamingo/10.png ADDED

Git LFS Details

  • SHA256: 62f3c9116b74bb2ee98138de9f2a82d267b12a3b0fddda793b886703909ad870
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
assets/davis_flamingo/11.png ADDED

Git LFS Details

  • SHA256: b1acf74e7849227602308c10e78e833f688b4f0147c04af74d928728898fc36d
  • Pointer size: 131 Bytes
  • Size of remote file: 100 kB
assets/davis_flamingo/12.png ADDED

Git LFS Details

  • SHA256: d90eadaec3155d745ff2a0cf97645c7b5cb1662b62dd8dad290f609b42e44b70
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
assets/davis_flamingo/13.png ADDED
assets/davis_flamingo/14.png ADDED
assets/davis_flamingo/15.png ADDED
assets/kangaroo.gif ADDED

Git LFS Details

  • SHA256: 79f2c71e5284be2b26d88a15860a37d78f96107927cec091d6abba3da8d3e627
  • Pointer size: 131 Bytes
  • Size of remote file: 579 kB
assets/kangaroo/00.png ADDED

Git LFS Details

  • SHA256: 8af000d6725444287cec2e1a6b9103321ec1dc08e03400dc2512457705949889
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
assets/kangaroo/01.png ADDED

Git LFS Details

  • SHA256: f17ce108a12a57480b87ba7d5e32951550134cb49c95c41537d7832d0e9ebc9c
  • Pointer size: 131 Bytes
  • Size of remote file: 118 kB
assets/kangaroo/02.png ADDED

Git LFS Details

  • SHA256: 411cebe55f2ecb07a4afecb4b904f554eecf2087394dcf8b7d323317424a9ab7
  • Pointer size: 131 Bytes
  • Size of remote file: 117 kB
assets/kangaroo/03.png ADDED

Git LFS Details

  • SHA256: 0cf7c66901ceec728043aca31e6f65b64c0ca557a569e219415da2c7ab9d05ac
  • Pointer size: 131 Bytes
  • Size of remote file: 114 kB
assets/kangaroo/04.png ADDED

Git LFS Details

  • SHA256: 1591c465c01f8e79703f9d1dfd82146bcc56f1150c7b8b9dc06a4009eb8dfdf7
  • Pointer size: 131 Bytes
  • Size of remote file: 108 kB
assets/kangaroo/05.png ADDED

Git LFS Details

  • SHA256: df49982ce0458cd478a623245a7a76f7b4a4773f3cbcb65c4ae828427ed6b087
  • Pointer size: 131 Bytes
  • Size of remote file: 108 kB
assets/kangaroo/06.png ADDED

Git LFS Details

  • SHA256: ff9a225afd1d429aa81ebc94cfd4704dae6f725ce7c72be8a82119fc48138947
  • Pointer size: 131 Bytes
  • Size of remote file: 107 kB
assets/kangaroo/07.png ADDED

Git LFS Details

  • SHA256: a184a7073c55891686bbb2a8eaebe25bcc7bff93266b67f95ad3d645285db667
  • Pointer size: 131 Bytes
  • Size of remote file: 107 kB
assets/kangaroo/08.png ADDED

Git LFS Details

  • SHA256: c933df5a151e37d231b5ebbcb991fe95ca43d7b3aa4261e5a93fff51f0730033
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
assets/kangaroo/09.png ADDED

Git LFS Details

  • SHA256: 6e95a22570b01239de8a465b030b69010076c97c20d9357481cf6523562e33b9
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB