Spaces:
Sleeping
Sleeping
Commit
·
7e275c7
1
Parent(s):
3b258c8
Update share_btn.py
Browse files- share_btn.py +18 -7
share_btn.py
CHANGED
@@ -38,9 +38,12 @@ share_js = """async () => {
|
|
38 |
}
|
39 |
|
40 |
const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
|
41 |
-
const
|
42 |
-
const
|
43 |
-
const
|
|
|
|
|
|
|
44 |
|
45 |
const shareBtnEl = gradioEl.querySelector('#share-btn');
|
46 |
const shareIconEl = gradioEl.querySelector('#share-btn-share-icon');
|
@@ -51,11 +54,19 @@ share_js = """async () => {
|
|
51 |
loadingIconEl.style.removeProperty('display');
|
52 |
|
53 |
const inputFile = await getInputImgFile(outputImgEl);
|
54 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
const descriptionMd = `
|
57 |
|
58 |
-
|
|
|
|
|
59 |
|
60 |
### Prompt
|
61 |
${inputPrompt}
|
@@ -64,12 +75,12 @@ ${inputPrompt}
|
|
64 |
<img src="${urlInputImg}" />
|
65 |
`;
|
66 |
const params = new URLSearchParams({
|
67 |
-
title:
|
68 |
description: descriptionMd,
|
69 |
preview: true
|
70 |
});
|
71 |
const paramsStr = params.toString();
|
72 |
-
window.open(`https://huggingface.co/spaces/multimodalart/
|
73 |
shareBtnEl.style.removeProperty('pointer-events');
|
74 |
shareIconEl.style.removeProperty('display');
|
75 |
loadingIconEl.style.display = 'none';
|
|
|
38 |
}
|
39 |
|
40 |
const gradioEl = document.querySelector("gradio-app").shadowRoot || document.querySelector('body > gradio-app');
|
41 |
+
const randomLoRA_1 = gradioEl.querySelector("#component-7 img")
|
42 |
+
const randomLoRA_1_title = gradioEl.querySelector("#component-7 [data-testid="block-label"] span").innerHTML
|
43 |
+
const randomLoRA_2 = gradioEl.querySelector("#component-7 img")
|
44 |
+
const randomLoRA_2_title = gradioEl.querySelector("#component-7 [data-testid="block-label"] span").innerHTML
|
45 |
+
const prompt = gradioEl.querySelector("#prompt textarea").value
|
46 |
+
const outputImgEl = gradioEl.querySelector('#component-22 img');
|
47 |
|
48 |
const shareBtnEl = gradioEl.querySelector('#share-btn');
|
49 |
const shareIconEl = gradioEl.querySelector('#share-btn-share-icon');
|
|
|
54 |
loadingIconEl.style.removeProperty('display');
|
55 |
|
56 |
const inputFile = await getInputImgFile(outputImgEl);
|
57 |
+
const urlOutputImg = await uploadFile(inputFile);
|
58 |
+
|
59 |
+
const inputFile = await getInputImgFile(randomLoRA_1);
|
60 |
+
const urlLoRA1 = await uploadFile(inputFile);
|
61 |
+
|
62 |
+
const inputFile = await getInputImgFile(randomLoRA_2);
|
63 |
+
const urlLoRA2 = await uploadFile(inputFile);
|
64 |
|
65 |
const descriptionMd = `
|
66 |
|
67 |
+
| {randomLoRA_1_title} | | {randomLoRA_2_title}|
|
68 |
+
|---------|-----------|---------|
|
69 |
+
|  | + |  |
|
70 |
|
71 |
### Prompt
|
72 |
${inputPrompt}
|
|
|
75 |
<img src="${urlInputImg}" />
|
76 |
`;
|
77 |
const params = new URLSearchParams({
|
78 |
+
title: prompt,
|
79 |
description: descriptionMd,
|
80 |
preview: true
|
81 |
});
|
82 |
const paramsStr = params.toString();
|
83 |
+
window.open(`https://huggingface.co/spaces/multimodalart/lora-roulette/discussions/new?${paramsStr}`, '_blank');
|
84 |
shareBtnEl.style.removeProperty('pointer-events');
|
85 |
shareIconEl.style.removeProperty('display');
|
86 |
loadingIconEl.style.display = 'none';
|