Spaces:
Runtime error
Runtime error
Download index.html from carsten12/bodymeasure: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/spaces/carsten12/bodymeasure/resolve/main/index.html
- Command line
-
hf download hf://spaces/carsten12/bodymeasure/index.html
-
curl -L -o index.html https://huggingface.co/spaces/carsten12/bodymeasure/resolve/main/index.html
1.95 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Body Measurement API Tester</title> | |
| <style> | |
| body { font-family: sans-serif; max-width: 600px; margin: auto; padding: 20px; } | |
| select, input, button, textarea { display: block; margin-top: 10px; width: 100%; padding: 8px; } | |
| textarea { height: 200px; } | |
| </style> | |
| </head> | |
| <body> | |
| <h2>Upload Body Model File & Measure</h2> | |
| <label for="modelFile">Upload Model File</label> | |
| <input type="file" id="modelFile" /> | |
| <label for="gender">Select Gender</label> | |
| <select id="gender"> | |
| <option value="NEUTRAL">NEUTRAL</option> | |
| <option value="MALE">MALE</option> | |
| <option value="FEMALE">FEMALE</option> | |
| </select> | |
| <label for="shape">Shape Coefficients (comma-separated 10 floats)</label> | |
| <input type="text" id="shape" value="0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0"> | |
| <button onclick="sendRequest()">Measure</button> | |
| <h3>Response</h3> | |
| <textarea id="response" readonly></textarea> | |
| <script> | |
| async function sendRequest() { | |
| const fileInput = document.getElementById("modelFile"); | |
| const file = fileInput.files[0]; | |
| if (!file) { | |
| alert("Please upload a model file."); | |
| return; | |
| } | |
| const gender = document.getElementById("gender").value; | |
| const shape = document.getElementById("shape").value | |
| .split(",") | |
| .map(parseFloat); | |
| const formData = new FormData(); | |
| formData.append("model_file", file); | |
| formData.append("gender", gender); | |
| formData.append("shape", JSON.stringify(shape)); | |
| try { | |
| const res = await fetch("/measure", { | |
| method: "POST", | |
| body: formData | |
| }); | |
| const json = await res.json(); | |
| document.getElementById("response").value = JSON.stringify(json, null, 2); | |
| } catch (err) { | |
| document.getElementById("response").value = err.toString(); | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |