multimodalart HF staff commited on
Commit
8fe6d25
1 Parent(s): 2909903

Update share_btn.py

Browse files
Files changed (1) hide show
  1. share_btn.py +4 -1
share_btn.py CHANGED
@@ -10,7 +10,10 @@ loading_icon_html = """<svg id="share-btn-loading-icon" style="display:none;" cl
10
 
11
  share_js = """async () => {
12
  async function uploadFile(file){
13
- console.log(file.type)
 
 
 
14
  const UPLOAD_URL = 'https://huggingface.co/uploads';
15
  const response = await fetch(UPLOAD_URL, {
16
  method: 'POST',
 
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',