Upload app.py
Browse files
app.py
CHANGED
|
@@ -187,9 +187,9 @@ js +="""
|
|
| 187 |
const btn = e.target.closest('button[aria-label="Download"]');
|
| 188 |
if (btn)
|
| 189 |
{
|
|
|
|
| 190 |
e.preventDefault();
|
| 191 |
e.stopPropagation();
|
| 192 |
-
//alert("Download intercepted!");
|
| 193 |
OverrideEmbeddedDownloadButtonInImageOrGalleryGradioControl();
|
| 194 |
}
|
| 195 |
}, true);
|
|
@@ -209,32 +209,27 @@ js +="""
|
|
| 209 |
#//...
|
| 210 |
js +="""
|
| 211 |
function OverrideEmbeddedDownloadButtonInImageOrGalleryGradioControl() {
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
for (const img of images) {
|
| 218 |
-
const style = window.getComputedStyle(img);
|
| 219 |
-
if ( style.display !== "none" && style.visibility !== "hidden" && img.offsetWidth > 0 && img.offsetHeight > 0 )
|
| 220 |
{
|
| 221 |
-
|
| 222 |
break;
|
| 223 |
}
|
| 224 |
else
|
| 225 |
continue;
|
| 226 |
}
|
| 227 |
-
|
| 228 |
-
if (!visibleImage) {
|
| 229 |
console.log('No img found');
|
| 230 |
} else {
|
| 231 |
-
|
| 232 |
-
window.open(visibleImage.src, "_blank");
|
| 233 |
}
|
| 234 |
}
|
| 235 |
"""
|
| 236 |
|
| 237 |
|
| 238 |
read_key = os.environ.get('HF_TOKEN__PRIVATE2PUBLIC', None)
|
| 239 |
-
app = gr.load(name="angelts/flux-gguf-lora-upscale-rmbg-t2i-i2i-controlnetunionpro2-AngelTs-Gradio2Comfyui", src="spaces", token=read_key)
|
| 240 |
-
app.queue(api_open=False, max_size=20).launch(debug=
|
|
|
|
| 187 |
const btn = e.target.closest('button[aria-label="Download"]');
|
| 188 |
if (btn)
|
| 189 |
{
|
| 190 |
+
//btn.click();
|
| 191 |
e.preventDefault();
|
| 192 |
e.stopPropagation();
|
|
|
|
| 193 |
OverrideEmbeddedDownloadButtonInImageOrGalleryGradioControl();
|
| 194 |
}
|
| 195 |
}, true);
|
|
|
|
| 209 |
#//...
|
| 210 |
js +="""
|
| 211 |
function OverrideEmbeddedDownloadButtonInImageOrGalleryGradioControl() {
|
| 212 |
+
let img = null;
|
| 213 |
+
const images = document.querySelectorAll("div.gallery-container span.preview button.media-button img, div.image-container button div.image-frame img"); //in gr.Gallery() and in gr.Image()
|
| 214 |
+
for (const currentimage of images) {
|
| 215 |
+
const style = window.getComputedStyle(currentimage);
|
| 216 |
+
if ( style.display !== "none" && style.visibility !== "hidden" && currentimage.offsetWidth > 0 && currentimage.offsetHeight > 0 )
|
|
|
|
|
|
|
|
|
|
| 217 |
{
|
| 218 |
+
img = currentimage;
|
| 219 |
break;
|
| 220 |
}
|
| 221 |
else
|
| 222 |
continue;
|
| 223 |
}
|
| 224 |
+
if (!img) {
|
|
|
|
| 225 |
console.log('No img found');
|
| 226 |
} else {
|
| 227 |
+
window.open(img.src, "_blank");
|
|
|
|
| 228 |
}
|
| 229 |
}
|
| 230 |
"""
|
| 231 |
|
| 232 |
|
| 233 |
read_key = os.environ.get('HF_TOKEN__PRIVATE2PUBLIC', None)
|
| 234 |
+
app = gr.load(name="angelts/flux-gguf-lora-upscale-rmbg-t2i-i2i-controlnetunionpro2-AngelTs-Gradio2Comfyui", src="spaces", token=read_key, api_name=False)
|
| 235 |
+
app.queue(api_open=False, max_size=20).launch(share=False,debug=False,footer_links=["gradio", "settings"],head=head,css=css,js=js)
|