Spaces:
Runtime error
Runtime error
Commit
•
ae0a298
1
Parent(s):
8fe6d25
Update share_btn.py
Browse files- share_btn.py +1 -5
share_btn.py
CHANGED
@@ -10,15 +10,11 @@ loading_icon_html = """<svg id="share-btn-loading-icon" style="display:none;" cl
|
|
10 |
|
11 |
share_js = """async () => {
|
12 |
async function uploadFile(file){
|
13 |
-
const validTypes = ["image/jpeg", "image/png"];
|
14 |
-
if (!validTypes.includes(file.type)) {
|
15 |
-
file.type = "image/jpeg";
|
16 |
-
}
|
17 |
const UPLOAD_URL = 'https://huggingface.co/uploads';
|
18 |
const response = await fetch(UPLOAD_URL, {
|
19 |
method: 'POST',
|
20 |
headers: {
|
21 |
-
'Content-Type':
|
22 |
'X-Requested-With': 'XMLHttpRequest',
|
23 |
},
|
24 |
body: file, /// <- File inherits from Blob
|
|
|
10 |
|
11 |
share_js = """async () => {
|
12 |
async function uploadFile(file){
|
|
|
|
|
|
|
|
|
13 |
const UPLOAD_URL = 'https://huggingface.co/uploads';
|
14 |
const response = await fetch(UPLOAD_URL, {
|
15 |
method: 'POST',
|
16 |
headers: {
|
17 |
+
'Content-Type': "image/jpeg",
|
18 |
'X-Requested-With': 'XMLHttpRequest',
|
19 |
},
|
20 |
body: file, /// <- File inherits from Blob
|