mishig HF staff commited on
Commit
ba44838
1 Parent(s): 39a33e3

fix share_btn

Browse files
Files changed (1) hide show
  1. share_btn.py +3 -3
share_btn.py CHANGED
@@ -28,12 +28,12 @@ share_js = """async () => {
28
  const res = await fetch(src);
29
  const blob = await res.blob();
30
  const imgId = Date.now() % 200;
31
- const isPng = src.startsWith(`data:image/png`);
32
  if(isPng){
33
- const fileName = `controlnet-3d-pose-${{imgId}}.png`;
34
  return new File([blob], fileName, { type: 'image/png' });
35
  }else{
36
- const fileName = `controlnet-3d-pose-${{imgId}}.jpg`;
37
  return new File([blob], fileName, { type: 'image/jpeg' });
38
  }
39
  }
 
28
  const res = await fetch(src);
29
  const blob = await res.blob();
30
  const imgId = Date.now() % 200;
31
+ const isPng = !!imgEl;
32
  if(isPng){
33
+ const fileName = `controlnet-3d-pose-${imgId}.png`;
34
  return new File([blob], fileName, { type: 'image/png' });
35
  }else{
36
+ const fileName = `controlnet-3d-pose-${imgId}.jpg`;
37
  return new File([blob], fileName, { type: 'image/jpeg' });
38
  }
39
  }