Spaces:
Running
Running
Update index.html
Browse files- index.html +19 -0
index.html
CHANGED
|
@@ -15,5 +15,24 @@
|
|
| 15 |
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
| 16 |
</p>
|
| 17 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</body>
|
| 19 |
</html>
|
|
|
|
| 15 |
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
| 16 |
</p>
|
| 17 |
</div>
|
| 18 |
+
<script>
|
| 19 |
+
async function query(filename) {
|
| 20 |
+
const data = fs.readFileSync(filename);
|
| 21 |
+
const response = await fetch(
|
| 22 |
+
"https://api-inference.huggingface.co/models/u2003158/bestmodelv5",
|
| 23 |
+
{
|
| 24 |
+
headers: { Authorization: "Bearer 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" },
|
| 25 |
+
method: "POST",
|
| 26 |
+
body: data,
|
| 27 |
+
}
|
| 28 |
+
);
|
| 29 |
+
const result = await response.json();
|
| 30 |
+
return result;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
query("cats.jpg").then((response) => {
|
| 34 |
+
console.log(JSON.stringify(response));
|
| 35 |
+
});
|
| 36 |
+
</script>
|
| 37 |
</body>
|
| 38 |
</html>
|