Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ text_gen = gr.Interface.load(name="spaces/Gustavosta/MagicPrompt-Stable-Diffusio
|
|
| 6 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 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)
|
|
@@ -89,13 +90,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 89 |
inputs = [input_text],
|
| 90 |
outputs = [
|
| 91 |
text_output
|
| 92 |
-
])
|
| 93 |
diffuse_btn.click(get_images,
|
| 94 |
inputs = [
|
| 95 |
text_output
|
| 96 |
],
|
| 97 |
-
outputs = [sd_output, community_icon, loading_icon, share_button]
|
| 98 |
-
)
|
| 99 |
share_button.click(None, [], [], _js=share_js)
|
| 100 |
|
| 101 |
|
|
|
|
| 6 |
stable_diffusion = gr.Blocks.load(name="spaces/runwayml/stable-diffusion-v1-5")
|
| 7 |
|
| 8 |
def get_images(prompt):
|
| 9 |
+
|
| 10 |
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
| 11 |
sd_output = [os.path.join(gallery_dir, image) for image in os.listdir(gallery_dir)]
|
| 12 |
return sd_output, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
|
|
|
| 90 |
inputs = [input_text],
|
| 91 |
outputs = [
|
| 92 |
text_output
|
| 93 |
+
], api_name="GetPrompts")
|
| 94 |
diffuse_btn.click(get_images,
|
| 95 |
inputs = [
|
| 96 |
text_output
|
| 97 |
],
|
| 98 |
+
outputs = [sd_output, community_icon, loading_icon, share_button], api_name="GetImages")
|
|
|
|
| 99 |
share_button.click(None, [], [], _js=share_js)
|
| 100 |
|
| 101 |
|