Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from PIL import Image
|
|
| 5 |
from diffusers.models import AutoencoderKL
|
| 6 |
from diffusers import AutoPipelineForInpainting, UNet2DConditionModel, DiffusionPipeline
|
| 7 |
import diffusers
|
| 8 |
-
|
| 9 |
|
| 10 |
|
| 11 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
|
@@ -102,6 +102,14 @@ css = '''
|
|
| 102 |
transform: rotate(360deg);
|
| 103 |
}
|
| 104 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
#prompt input{width: calc(100% - 160px);border-top-right-radius: 0px;border-bottom-right-radius: 0px;}
|
| 106 |
#prompt-container{margin-top:-18px;}
|
| 107 |
#prompt-container .form{border-top-left-radius: 0;border-top-right-radius: 0}
|
|
@@ -136,10 +144,15 @@ with image_blocks as demo:
|
|
| 136 |
|
| 137 |
with gr.Column():
|
| 138 |
image_out = gr.Image(label="Output", elem_id="output-img", height=1024, width=512)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
-
btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out], api_name='run')
|
| 142 |
-
prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out])
|
|
|
|
| 143 |
|
| 144 |
|
| 145 |
image_blocks.queue(max_size=25,api_open=True).launch(show_api=True)
|
|
|
|
| 5 |
from diffusers.models import AutoencoderKL
|
| 6 |
from diffusers import AutoPipelineForInpainting, UNet2DConditionModel, DiffusionPipeline
|
| 7 |
import diffusers
|
| 8 |
+
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 9 |
|
| 10 |
|
| 11 |
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
|
|
|
| 102 |
transform: rotate(360deg);
|
| 103 |
}
|
| 104 |
}
|
| 105 |
+
#share-btn-container {padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;}
|
| 106 |
+
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
| 107 |
+
#share-btn-container:hover {background-color: #060606}
|
| 108 |
+
#share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;}
|
| 109 |
+
#share-btn * {all: unset}
|
| 110 |
+
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
| 111 |
+
#share-btn-container .wrap {display: none !important}
|
| 112 |
+
#share-btn-container.hidden {display: none!important}
|
| 113 |
#prompt input{width: calc(100% - 160px);border-top-right-radius: 0px;border-bottom-right-radius: 0px;}
|
| 114 |
#prompt-container{margin-top:-18px;}
|
| 115 |
#prompt-container .form{border-top-left-radius: 0;border-top-right-radius: 0}
|
|
|
|
| 144 |
|
| 145 |
with gr.Column():
|
| 146 |
image_out = gr.Image(label="Output", elem_id="output-img", height=1024, width=512)
|
| 147 |
+
with gr.Group(elem_id="share-btn-container", visible=False) as share_btn_container:
|
| 148 |
+
community_icon = gr.HTML(community_icon_html)
|
| 149 |
+
loading_icon = gr.HTML(loading_icon_html)
|
| 150 |
+
share_button = gr.Button("Share to community", elem_id="share-btn",visible=True)
|
| 151 |
|
| 152 |
|
| 153 |
+
btn.click(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out,share_btn_container], api_name='run')
|
| 154 |
+
prompt.submit(fn=predict, inputs=[image, prompt, negative_prompt, guidance_scale, steps, strength, model, scheduler], outputs=[image_out,share_btn_container])
|
| 155 |
+
share_button.click(None, [], [], _js=share_js)
|
| 156 |
|
| 157 |
|
| 158 |
image_blocks.queue(max_size=25,api_open=True).launch(show_api=True)
|