Jean0 commited on
Commit
fa1c13f
·
verified ·
1 Parent(s): 1b62438

améliore je veux un personnage réelle une femme américaine de 35 ans

Browse files
Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +296 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Facemotion Beauty Simulator
3
- emoji: 😻
4
- colorFrom: indigo
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: FaceMotion Beauty Simulator 💄
3
+ colorFrom: yellow
4
+ colorTo: blue
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,296 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FaceMotion Simulator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
9
+ <link rel="stylesheet" href="style.css">
10
+ </head>
11
+ <body class="bg-indigo-50 min-h-screen flex items-center justify-center p-4">
12
+ <div class="max-w-md w-full bg-white rounded-2xl shadow-xl overflow-hidden">
13
+ <!-- Header -->
14
+ <div class="bg-indigo-600 p-6 text-white">
15
+ <div class="flex items-center justify-between">
16
+ <div>
17
+ <h1 class="text-2xl font-bold">FaceMotion Simulator</h1>
18
+ <p class="text-indigo-100">Interactive 3D Head Tracking</p>
19
+ </div>
20
+ <div class="w-12 h-12 rounded-full bg-indigo-500 flex items-center justify-center">
21
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
22
+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
23
+ <circle cx="9" cy="7" r="4"></circle>
24
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
25
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
26
+ </svg>
27
+ </div>
28
+ </div>
29
+ </div>
30
+
31
+ <!-- 3D Canvas -->
32
+ <div id="canvas-container" class="w-full aspect-square bg-indigo-100 relative">
33
+ <canvas id="liveness-canvas" class="absolute inset-0 w-full h-full"></canvas>
34
+ <div class="absolute bottom-4 left-0 right-0 flex justify-center">
35
+ <div class="bg-indigo-600 text-white px-3 py-1 rounded-full text-xs font-medium shadow-md">
36
+ Move the sliders below
37
+ </div>
38
+ </div>
39
+ </div>
40
+
41
+ <!-- Controls -->
42
+ <div class="p-6 space-y-6">
43
+ <div>
44
+ <div class="flex justify-between mb-2">
45
+ <label for="rotate-y" class="text-sm font-medium text-gray-700">Horizontal Rotation</label>
46
+ <span id="rotate-y-value" class="text-sm text-indigo-600 font-medium">0°</span>
47
+ </div>
48
+ <input type="range" id="rotate-y" min="-80" max="80" value="0" class="w-full h-2 bg-indigo-200 rounded-lg appearance-none cursor-pointer">
49
+ </div>
50
+
51
+ <div>
52
+ <div class="flex justify-between mb-2">
53
+ <label for="rotate-x" class="text-sm font-medium text-gray-700">Vertical Rotation</label>
54
+ <span id="rotate-x-value" class="text-sm text-indigo-600 font-medium">0°</span>
55
+ </div>
56
+ <input type="range" id="rotate-x" min="-45" max="45" value="0" class="w-full h-2 bg-indigo-200 rounded-lg appearance-none cursor-pointer">
57
+ </div>
58
+
59
+ <button id="reset-btn" class="w-full py-2 px-4 bg-indigo-100 hover:bg-indigo-200 text-indigo-700 font-medium rounded-lg transition duration-200 flex items-center justify-center space-x-2">
60
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
61
+ <polyline points="1 4 1 10 7 10"></polyline>
62
+ <polyline points="23 20 23 14 17 14"></polyline>
63
+ <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"></path>
64
+ </svg>
65
+ <span>Reset Position</span>
66
+ </button>
67
+ </div>
68
+ </div>
69
+
70
+ <script>
71
+ // === 3D Scene Initialization ===
72
+ const canvasContainer = document.getElementById('canvas-container');
73
+ const canvas = document.getElementById('liveness-canvas');
74
+
75
+ // Scene
76
+ const scene = new THREE.Scene();
77
+ scene.background = null;
78
+
79
+ // Camera
80
+ const camera = new THREE.PerspectiveCamera(75, canvasContainer.clientWidth / canvasContainer.clientHeight, 0.1, 1000);
81
+ camera.position.z = 5;
82
+
83
+ // Renderer
84
+ const renderer = new THREE.WebGLRenderer({
85
+ canvas: canvas,
86
+ antialias: true,
87
+ alpha: true
88
+ });
89
+ renderer.setPixelRatio(window.devicePixelRatio);
90
+ renderer.setSize(canvasContainer.clientWidth, canvasContainer.clientHeight);
91
+ // === Create Realistic Female Face ===
92
+ const headGroup = new THREE.Group();
93
+ scene.add(headGroup);
94
+
95
+ // Head (Ellipsoid for more realistic shape)
96
+ const headGeometry = new THREE.SphereGeometry(1.8, 64, 64);
97
+ headGeometry.scale(0.8, 1.1, 0.9); // More oval shape
98
+ const headMaterial = new THREE.MeshStandardMaterial({
99
+ color: 0xF5D0B9,
100
+ roughness: 0.4,
101
+ metalness: 0.1,
102
+ map: new THREE.TextureLoader().load('https://static.photos/people/1024x576/35')
103
+ });
104
+ const head = new THREE.Mesh(headGeometry, headMaterial);
105
+ headGroup.add(head);
106
+
107
+ // Eyes
108
+ const eyeGeometry = new THREE.SphereGeometry(0.25, 32, 32);
109
+ const eyeMaterial = new THREE.MeshStandardMaterial({
110
+ color: 0xffffff,
111
+ roughness: 0.1,
112
+ metalness: 0.1
113
+ });
114
+
115
+ // Left Eye
116
+ const eyeLeft = new THREE.Mesh(eyeGeometry, eyeMaterial);
117
+ eyeLeft.position.set(-0.7, 0.3, 1.8);
118
+ headGroup.add(eyeLeft);
119
+
120
+ // Right Eye
121
+ const eyeRight = new THREE.Mesh(eyeGeometry, eyeMaterial.clone());
122
+ eyeRight.position.set(0.7, 0.3, 1.8);
123
+ headGroup.add(eyeRight);
124
+
125
+ // Pupils
126
+ const pupilGeometry = new THREE.SphereGeometry(0.12, 32, 32);
127
+ const pupilMaterial = new THREE.MeshStandardMaterial({
128
+ color: 0x4A2C12,
129
+ });
130
+
131
+ // Left Pupil
132
+ const pupilLeft = new THREE.Mesh(pupilGeometry, pupilMaterial);
133
+ pupilLeft.position.set(0, 0, 0.25);
134
+ eyeLeft.add(pupilLeft);
135
+
136
+ // Right Pupil
137
+ const pupilRight = new THREE.Mesh(pupilGeometry, pupilMaterial.clone());
138
+ pupilRight.position.set(0, 0, 0.25);
139
+ eyeRight.add(pupilRight);
140
+
141
+ // Eyelashes
142
+ const eyelashGeometry = new THREE.ConeGeometry(0.02, 0.15, 4);
143
+ const eyelashMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 });
144
+
145
+ // Left Eyelashes
146
+ for (let i = 0; i < 8; i++) {
147
+ const angle = (i / 8) * Math.PI * 0.5 - Math.PI * 0.25;
148
+ const eyelash = new THREE.Mesh(eyelashGeometry, eyelashMaterial);
149
+ eyelash.position.set(-0.7 + Math.cos(angle) * 0.3, 0.3 + Math.sin(angle) * 0.3, 1.85);
150
+ eyelash.rotation.z = angle;
151
+ headGroup.add(eyelash);
152
+ }
153
+
154
+ // Right Eyelashes
155
+ for (let i = 0; i < 8; i++) {
156
+ const angle = (i / 8) * Math.PI * 0.5 - Math.PI * 0.25;
157
+ const eyelash = new THREE.Mesh(eyelashGeometry, eyelashMaterial.clone());
158
+ eyelash.position.set(0.7 + Math.cos(angle) * 0.3, 0.3 + Math.sin(angle) * 0.3, 1.85);
159
+ eyelash.rotation.z = angle;
160
+ headGroup.add(eyelash);
161
+ }
162
+
163
+ // Nose (more refined)
164
+ const noseGeometry = new THREE.ConeGeometry(0.3, 0.6, 32);
165
+ const noseMaterial = new THREE.MeshStandardMaterial({
166
+ color: 0xE8BBA5,
167
+ roughness: 0.4
168
+ });
169
+ const nose = new THREE.Mesh(noseGeometry, noseMaterial);
170
+ nose.position.set(0, 0, 1.9);
171
+ nose.rotation.x = Math.PI / 10;
172
+ headGroup.add(nose);
173
+
174
+ // Lips
175
+ const lipGeometry = new THREE.TorusGeometry(0.4, 0.08, 16, 32, Math.PI);
176
+ const lipMaterial = new THREE.MeshStandardMaterial({
177
+ color: 0xC45C6B,
178
+ roughness: 0.3,
179
+ metalness: 0.2
180
+ });
181
+ const lips = new THREE.Mesh(lipGeometry, lipMaterial);
182
+ lips.position.set(0, -0.3, 1.7);
183
+ lips.rotation.x = Math.PI / 8;
184
+ headGroup.add(lips);
185
+
186
+ // Eyebrows
187
+ const eyebrowGeometry = new THREE.BoxGeometry(0.5, 0.05, 0.02);
188
+ const eyebrowMaterial = new THREE.MeshStandardMaterial({ color: 0x3A2A1A });
189
+
190
+ // Left Eyebrow
191
+ const leftEyebrow = new THREE.Mesh(eyebrowGeometry, eyebrowMaterial);
192
+ leftEyebrow.position.set(-0.7, 0.5, 1.8);
193
+ leftEyebrow.rotation.z = -0.2;
194
+ headGroup.add(leftEyebrow);
195
+
196
+ // Right Eyebrow
197
+ const rightEyebrow = new THREE.Mesh(eyebrowGeometry, eyebrowMaterial.clone());
198
+ rightEyebrow.position.set(0.7, 0.5, 1.8);
199
+ rightEyebrow.rotation.z = 0.2;
200
+ headGroup.add(rightEyebrow);
201
+
202
+ // Hair (simplified)
203
+ const hairGeometry = new THREE.SphereGeometry(2.0, 32, 32);
204
+ hairGeometry.scale(0.9, 1.2, 1.0);
205
+ const hairMaterial = new THREE.MeshStandardMaterial({
206
+ color: 0x4B3A2D,
207
+ roughness: 0.8,
208
+ metalness: 0.1
209
+ });
210
+ const hair = new THREE.Mesh(hairGeometry, hairMaterial);
211
+ hair.position.set(0, 0.4, 0);
212
+ headGroup.add(hair);
213
+ // Enhanced Lighting
214
+ const ambientLight = new THREE.AmbientLight(0xffffff, 0.6);
215
+ scene.add(ambientLight);
216
+
217
+ const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
218
+ directionalLight.position.set(3, 5, 5);
219
+ directionalLight.castShadow = true;
220
+ directionalLight.shadow.mapSize.width = 1024;
221
+ directionalLight.shadow.mapSize.height = 1024;
222
+ scene.add(directionalLight);
223
+
224
+ const fillLight = new THREE.DirectionalLight(0xffffff, 0.5);
225
+ fillLight.position.set(-3, 2, 3);
226
+ scene.add(fillLight);
227
+
228
+ const rimLight = new THREE.DirectionalLight(0xffffff, 0.3);
229
+ rimLight.position.set(0, 3, -5);
230
+ scene.add(rimLight);
231
+ // === Controls ===
232
+ const sliderY = document.getElementById('rotate-y');
233
+ const sliderX = document.getElementById('rotate-x');
234
+ const rotateYValue = document.getElementById('rotate-y-value');
235
+ const rotateXValue = document.getElementById('rotate-x-value');
236
+ const resetBtn = document.getElementById('reset-btn');
237
+
238
+ sliderY.addEventListener('input', (e) => {
239
+ const rotationRadians = (e.target.value * Math.PI) / 180;
240
+ headGroup.rotation.y = rotationRadians;
241
+ rotateYValue.textContent = `${e.target.value}°`;
242
+ });
243
+
244
+ sliderX.addEventListener('input', (e) => {
245
+ const rotationRadians = (e.target.value * Math.PI) / 180;
246
+ headGroup.rotation.x = rotationRadians;
247
+ rotateXValue.textContent = `${e.target.value}°`;
248
+ });
249
+
250
+ resetBtn.addEventListener('click', () => {
251
+ sliderY.value = 0;
252
+ sliderX.value = 0;
253
+ headGroup.rotation.set(0, 0, 0);
254
+ rotateYValue.textContent = '0°';
255
+ rotateXValue.textContent = '0°';
256
+ });
257
+ // Animation Loop with subtle blinking
258
+ let blinkTimer = 0;
259
+ let blinkState = false;
260
+
261
+ function animate() {
262
+ requestAnimationFrame(animate);
263
+
264
+ // Blinking animation
265
+ blinkTimer += 0.01;
266
+ if (blinkTimer > 5 && !blinkState) {
267
+ eyeLeft.scale.y = 0.05;
268
+ eyeRight.scale.y = 0.05;
269
+ blinkState = true;
270
+ blinkTimer = 0;
271
+ } else if (blinkTimer > 0.1 && blinkState) {
272
+ eyeLeft.scale.y = 1;
273
+ eyeRight.scale.y = 1;
274
+ blinkState = false;
275
+ blinkTimer = 0;
276
+ }
277
+
278
+ renderer.render(scene, camera);
279
+ }
280
+ // Handle Window Resize
281
+ function onResize() {
282
+ const width = canvasContainer.clientWidth;
283
+ const height = canvasContainer.clientHeight;
284
+
285
+ renderer.setSize(width, height);
286
+ camera.aspect = width / height;
287
+ camera.updateProjectionMatrix();
288
+ }
289
+
290
+ window.addEventListener('resize', onResize);
291
+ animate();
292
+ onResize();
293
+ </script>
294
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
295
+ </body>
296
+ </html>