Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,8 @@ def get_images(prompt):
|
|
| 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(
|
| 14 |
-
return text_gen(
|
| 15 |
|
| 16 |
css = '''
|
| 17 |
.animate-spin {
|
|
@@ -55,15 +55,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 55 |
"
|
| 56 |
>
|
| 57 |
<h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
|
| 58 |
-
Stable Diffusion Magic Prompt
|
| 59 |
</h1>
|
| 60 |
</div>
|
| 61 |
-
<p style="margin-bottom: 10px; font-size: 94%">
|
| 62 |
-
Sends an image in to <a href="https://huggingface.co/spaces/pharma/CLIP-Interrogator" target="_blank">CLIP Interrogator</a>
|
| 63 |
-
to generate a text prompt which is then run through
|
| 64 |
-
<a href="https://huggingface.co/spaces/stabilityai/stable-diffusion" target="_blank">Stable Diffusion</a>
|
| 65 |
-
to generate new forms of the original!
|
| 66 |
-
</p>
|
| 67 |
</div>""")
|
| 68 |
|
| 69 |
with gr.Row():
|
|
@@ -88,7 +82,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 88 |
share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
|
| 89 |
|
| 90 |
see_prompts.click(get_prompts,
|
| 91 |
-
inputs = input_text,
|
| 92 |
outputs = [
|
| 93 |
text_output
|
| 94 |
])
|
|
|
|
| 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(prompt_text):
|
| 14 |
+
return text_gen(prompt_text, fn_index=1)[0]
|
| 15 |
|
| 16 |
css = '''
|
| 17 |
.animate-spin {
|
|
|
|
| 55 |
"
|
| 56 |
>
|
| 57 |
<h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
|
| 58 |
+
Stable Diffusion Magic Prompt π
|
| 59 |
</h1>
|
| 60 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
</div>""")
|
| 62 |
|
| 63 |
with gr.Row():
|
|
|
|
| 82 |
share_button = gr.Button("Share to community", elem_id="share-btn", visible=False)
|
| 83 |
|
| 84 |
see_prompts.click(get_prompts,
|
| 85 |
+
inputs = [input_text],
|
| 86 |
outputs = [
|
| 87 |
text_output
|
| 88 |
])
|