Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,6 @@ if not torch.cuda.is_available():
|
|
13 |
DESCRIPTION += "\n<p>你现在运行在CPU上 但是只支持GPU.</p>"
|
14 |
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
-
CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv("CACHE_EXAMPLES", "1") == "1"
|
17 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "4096"))
|
18 |
USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE", "0") == "1"
|
19 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
|
@@ -64,10 +63,6 @@ def infer(
|
|
64 |
examples = [
|
65 |
"a cat eating a piece of cheese",
|
66 |
"a ROBOT riding a BLUE horse on Mars, photorealistic, 4k",
|
67 |
-
"Ironman VS Hulk, ultrarealistic",
|
68 |
-
"Astronaut in a jungle, cold color palette, oil pastel, detailed, 8k",
|
69 |
-
"An alien holding sign board contain word 'Flash', futuristic, neonpunk",
|
70 |
-
"Kids going to school, Anime style"
|
71 |
]
|
72 |
|
73 |
css = '''
|
@@ -141,14 +136,6 @@ with gr.Blocks(css=css) as demo:
|
|
141 |
value=28,
|
142 |
)
|
143 |
|
144 |
-
gr.Examples(
|
145 |
-
examples=examples,
|
146 |
-
inputs=prompt,
|
147 |
-
outputs=[result, seed],
|
148 |
-
fn=infer,
|
149 |
-
cache_examples=CACHE_EXAMPLES,
|
150 |
-
)
|
151 |
-
|
152 |
use_negative_prompt.change(
|
153 |
fn=lambda x: gr.update(visible=x),
|
154 |
inputs=use_negative_prompt,
|
@@ -156,11 +143,7 @@ with gr.Blocks(css=css) as demo:
|
|
156 |
)
|
157 |
|
158 |
gr.on(
|
159 |
-
triggers=[
|
160 |
-
prompt.submit,
|
161 |
-
negative_prompt.submit,
|
162 |
-
run_button.click,
|
163 |
-
],
|
164 |
fn=infer,
|
165 |
inputs=[
|
166 |
prompt,
|
|
|
13 |
DESCRIPTION += "\n<p>你现在运行在CPU上 但是只支持GPU.</p>"
|
14 |
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
16 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "4096"))
|
17 |
USE_TORCH_COMPILE = os.getenv("USE_TORCH_COMPILE", "0") == "1"
|
18 |
ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
|
|
|
63 |
examples = [
|
64 |
"a cat eating a piece of cheese",
|
65 |
"a ROBOT riding a BLUE horse on Mars, photorealistic, 4k",
|
|
|
|
|
|
|
|
|
66 |
]
|
67 |
|
68 |
css = '''
|
|
|
136 |
value=28,
|
137 |
)
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
use_negative_prompt.change(
|
140 |
fn=lambda x: gr.update(visible=x),
|
141 |
inputs=use_negative_prompt,
|
|
|
143 |
)
|
144 |
|
145 |
gr.on(
|
146 |
+
triggers=[prompt.submit,negative_prompt.submit],
|
|
|
|
|
|
|
|
|
147 |
fn=infer,
|
148 |
inputs=[
|
149 |
prompt,
|