songweig radames commited on
Commit
757e20b
1 Parent(s): aa79bf3

fix-share-bug (#9)

Browse files

- fix share data (b32988d1be53aa7faeb3e2c25270202a4d07d14b)


Co-authored-by: Radamés Ajna <radames@users.noreply.huggingface.co>

Files changed (1) hide show
  1. share_btn.py +3 -1
share_btn.py CHANGED
@@ -27,7 +27,9 @@ share_js = """async () => {
27
  return new File([blob], fileName, { type: 'image/png'});
28
  }
29
  const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
30
- const text_input = gradioEl.querySelector('#text_input input').value;
 
 
31
  const negative_prompt = gradioEl.querySelector('#negative_prompt input').value;
32
  const seed = gradioEl.querySelector('#seed input').value;
33
  const richTextImg = gradioEl.querySelector('#rich-text-image img');
 
27
  return new File([blob], fileName, { type: 'image/png'});
28
  }
29
  const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
30
+ const richEl = document.getElementById("rich-text-root");
31
+ const data = richEl? richEl.contentDocument.body._data : {};
32
+ const text_input = JSON.stringify(data);
33
  const negative_prompt = gradioEl.querySelector('#negative_prompt input').value;
34
  const seed = gradioEl.querySelector('#seed input').value;
35
  const richTextImg = gradioEl.querySelector('#rich-text-image img');