Spaces:
Sleeping
Sleeping
File size: 379 Bytes
b6caea7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
export async function uploadToHuggingFace(file: File) {
const UPLOAD_URL = 'https://huggingface.co/uploads'
const response = await fetch(UPLOAD_URL, {
method: 'POST',
headers: {
'Content-Type': file.type,
'X-Requested-With': 'XMLHttpRequest',
},
body: file, /// <- File inherits from Blob
})
const url = await response.text()
return url
} |