Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
|
|
|
|
5 |
import gradio as gr
|
6 |
import PIL.Image
|
7 |
|
@@ -9,7 +11,7 @@ from model import Model
|
|
9 |
|
10 |
DESCRIPTION = '''# Attend-and-Excite
|
11 |
This is a demo for [Attend-and-Excite](https://arxiv.org/abs/2301.13826).
|
12 |
-
Attend-and-Excite performs attention-based generative semantic guidance to mitigate subject neglect in Stable Diffusion.
|
13 |
Select a prompt and a set of indices matching the subjects you wish to strengthen (the `Check token indices` cell can help map between a word and its index).
|
14 |
'''
|
15 |
|
@@ -161,7 +163,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
161 |
result,
|
162 |
],
|
163 |
fn=process_example,
|
164 |
-
cache_examples=
|
165 |
examples_per_page=20)
|
166 |
|
167 |
show_token_indices_button.click(fn=model.get_token_table,
|
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
5 |
+
import os
|
6 |
+
|
7 |
import gradio as gr
|
8 |
import PIL.Image
|
9 |
|
|
|
11 |
|
12 |
DESCRIPTION = '''# Attend-and-Excite
|
13 |
This is a demo for [Attend-and-Excite](https://arxiv.org/abs/2301.13826).
|
14 |
+
Attend-and-Excite performs attention-based generative semantic guidance to mitigate subject neglect in Stable Diffusion.
|
15 |
Select a prompt and a set of indices matching the subjects you wish to strengthen (the `Check token indices` cell can help map between a word and its index).
|
16 |
'''
|
17 |
|
|
|
163 |
result,
|
164 |
],
|
165 |
fn=process_example,
|
166 |
+
cache_examples=os.getenv('CACHE_EXAMPLES') == '1',
|
167 |
examples_per_page=20)
|
168 |
|
169 |
show_token_indices_button.click(fn=model.get_token_table,
|