Spaces:
Running
Running
Share btn should only appear when sd run
Browse files
app.py
CHANGED
@@ -7,7 +7,8 @@ stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
|
|
7 |
|
8 |
def get_images(prompt):
|
9 |
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
10 |
-
|
|
|
11 |
|
12 |
def get_prompts(uploaded_image):
|
13 |
return img_to_text(uploaded_image)
|
@@ -67,9 +68,9 @@ with gr.Blocks(css=css) as demo:
|
|
67 |
with gr.Column(elem_id="generated-gallery"):
|
68 |
sd_output = gr.Gallery().style(grid=2, height="auto")
|
69 |
with gr.Group(elem_id="share-btn-container"):
|
70 |
-
community_icon = gr.HTML(community_icon_html)
|
71 |
-
loading_icon = gr.HTML(loading_icon_html)
|
72 |
-
share_button = gr.Button("Share to community", elem_id="share-btn")
|
73 |
|
74 |
see_prompts.click(img_to_text,
|
75 |
inputs = input_img,
|
@@ -80,7 +81,7 @@ with gr.Blocks(css=css) as demo:
|
|
80 |
inputs = [
|
81 |
img2text_output
|
82 |
],
|
83 |
-
outputs = sd_output
|
84 |
)
|
85 |
share_button.click(None, [], [], _js=share_js)
|
86 |
|
|
|
7 |
|
8 |
def get_images(prompt):
|
9 |
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
10 |
+
sd_output = [os.path.join(gallery_dir, image) for image in os.listdir(gallery_dir)]
|
11 |
+
return sd_output, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
12 |
|
13 |
def get_prompts(uploaded_image):
|
14 |
return img_to_text(uploaded_image)
|
|
|
68 |
with gr.Column(elem_id="generated-gallery"):
|
69 |
sd_output = gr.Gallery().style(grid=2, height="auto")
|
70 |
with gr.Group(elem_id="share-btn-container"):
|
71 |
+
community_icon = gr.HTML(community_icon_html, visible=False)
|
72 |
+
loading_icon = gr.HTML(loading_icon_html, visible=False)
|
73 |
+
share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
|
74 |
|
75 |
see_prompts.click(img_to_text,
|
76 |
inputs = input_img,
|
|
|
81 |
inputs = [
|
82 |
img2text_output
|
83 |
],
|
84 |
+
outputs = [sd_output, community_icon, loading_icon, share_button]
|
85 |
)
|
86 |
share_button.click(None, [], [], _js=share_js)
|
87 |
|