Spaces:
Runtime error
Runtime error
Update app.py
#21
by
Aditibaheti
- opened
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
| 4 |
import random
|
|
@@ -25,9 +24,6 @@ pipeline = DiffusionPipeline.from_pretrained(
|
|
| 25 |
)
|
| 26 |
pipeline.load_lora_weights(lora_weights_path)
|
| 27 |
|
| 28 |
-
# Comment out the line for sequential CPU offloading
|
| 29 |
-
# pipeline.enable_sequential_cpu_offload()
|
| 30 |
-
|
| 31 |
pipeline = pipeline.to(device)
|
| 32 |
|
| 33 |
MAX_SEED = np.iinfo(np.int32).max
|
|
@@ -53,9 +49,9 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
| 53 |
return image
|
| 54 |
|
| 55 |
examples = [
|
| 56 |
-
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
|
| 57 |
-
"An astronaut riding a green horse",
|
| 58 |
-
"A delicious ceviche cheesecake slice",
|
| 59 |
]
|
| 60 |
|
| 61 |
css = """
|
|
@@ -195,9 +191,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 195 |
value=30,
|
| 196 |
)
|
| 197 |
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
run_button.click(
|
| 202 |
fn=infer,
|
| 203 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import random
|
|
|
|
| 24 |
)
|
| 25 |
pipeline.load_lora_weights(lora_weights_path)
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
pipeline = pipeline.to(device)
|
| 28 |
|
| 29 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 49 |
return image
|
| 50 |
|
| 51 |
examples = [
|
| 52 |
+
["Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"],
|
| 53 |
+
["An astronaut riding a green horse"],
|
| 54 |
+
["A delicious ceviche cheesecake slice"],
|
| 55 |
]
|
| 56 |
|
| 57 |
css = """
|
|
|
|
| 191 |
value=30,
|
| 192 |
)
|
| 193 |
|
| 194 |
+
gr.Examples(examples=examples, inputs=prompt)
|
| 195 |
+
|
|
|
|
| 196 |
run_button.click(
|
| 197 |
fn=infer,
|
| 198 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|