Spaces:
Runtime error
Runtime error
better discussions format
Browse files- share_btn.py +4 -2
share_btn.py
CHANGED
|
@@ -40,6 +40,8 @@ share_js = """async () => {
|
|
| 40 |
const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
|
| 41 |
const inputImgEl = gradioEl.querySelector('#image-in img');
|
| 42 |
const outputTxt = gradioEl.querySelector('#story textarea').value;
|
|
|
|
|
|
|
| 43 |
|
| 44 |
const shareBtnEl = gradioEl.querySelector('#share-btn');
|
| 45 |
const shareIconEl = gradioEl.querySelector('#share-btn-share-icon');
|
|
@@ -56,13 +58,13 @@ share_js = """async () => {
|
|
| 56 |
const descriptionMd = `
|
| 57 |
|
| 58 |
#### Image input:
|
| 59 |
-
${urlInputImg}
|
| 60 |
|
| 61 |
#### Generated Story:
|
| 62 |
${outputTxt}
|
| 63 |
`;
|
| 64 |
const params = new URLSearchParams({
|
| 65 |
-
title:
|
| 66 |
description: descriptionMd,
|
| 67 |
});
|
| 68 |
const paramsStr = params.toString();
|
|
|
|
| 40 |
const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
|
| 41 |
const inputImgEl = gradioEl.querySelector('#image-in img');
|
| 42 |
const outputTxt = gradioEl.querySelector('#story textarea').value;
|
| 43 |
+
const wordsArray = outpuTxt.split(" ");
|
| 44 |
+
const firstSevenWords = wordsArray.slice(0, 7).join(" ");
|
| 45 |
|
| 46 |
const shareBtnEl = gradioEl.querySelector('#share-btn');
|
| 47 |
const shareIconEl = gradioEl.querySelector('#share-btn-share-icon');
|
|
|
|
| 58 |
const descriptionMd = `
|
| 59 |
|
| 60 |
#### Image input:
|
| 61 |
+
<img src="${urlInputImg}" />
|
| 62 |
|
| 63 |
#### Generated Story:
|
| 64 |
${outputTxt}
|
| 65 |
`;
|
| 66 |
const params = new URLSearchParams({
|
| 67 |
+
title: firstSevenWords,
|
| 68 |
description: descriptionMd,
|
| 69 |
});
|
| 70 |
const paramsStr = params.toString();
|