Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ import spaces
|
|
10 |
import torch
|
11 |
from diffusers import DiffusionPipeline
|
12 |
|
13 |
-
DESCRIPTION = """# SDXL Flash"""
|
14 |
if not torch.cuda.is_available():
|
15 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
16 |
|
@@ -54,7 +53,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
54 |
seed = random.randint(0, MAX_SEED)
|
55 |
return seed
|
56 |
|
57 |
-
@spaces.GPU(enable_queue=False)
|
58 |
def generate(
|
59 |
prompt: str,
|
60 |
negative_prompt: str = "",
|
@@ -98,15 +97,20 @@ examples = [
|
|
98 |
"an astronaut riding a horse in space",
|
99 |
"a cartoon of a boy playing with a tiger",
|
100 |
"a cute robot artist painting on an easel, concept art",
|
101 |
-
#"a close up of a woman wearing a transparent, prismatic, elaborate nemeses headdress, over the should pose, brown skin-
|
102 |
]
|
103 |
|
104 |
css = '''
|
105 |
.gradio-container{max-width: 560px !important}
|
106 |
h1{text-align:center}
|
|
|
|
|
|
|
107 |
'''
|
108 |
with gr.Blocks(css=css) as demo:
|
109 |
-
gr.Markdown(
|
|
|
|
|
110 |
with gr.Group():
|
111 |
with gr.Row():
|
112 |
prompt = gr.Text(
|
@@ -117,13 +121,14 @@ with gr.Blocks(css=css) as demo:
|
|
117 |
container=False,
|
118 |
)
|
119 |
run_button = gr.Button("Run", scale=0)
|
120 |
-
result = gr.Gallery(label="Result"
|
121 |
with gr.Accordion("Advanced options", open=False):
|
122 |
with gr.Row():
|
123 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
|
124 |
negative_prompt = gr.Text(
|
125 |
label="Negative prompt",
|
126 |
-
max_lines=
|
|
|
127 |
placeholder="Enter a negative prompt",
|
128 |
value="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, NSFW",
|
129 |
visible=True,
|
|
|
10 |
import torch
|
11 |
from diffusers import DiffusionPipeline
|
12 |
|
|
|
13 |
if not torch.cuda.is_available():
|
14 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
15 |
|
|
|
53 |
seed = random.randint(0, MAX_SEED)
|
54 |
return seed
|
55 |
|
56 |
+
@spaces.GPU(duration=20,enable_queue=False)
|
57 |
def generate(
|
58 |
prompt: str,
|
59 |
negative_prompt: str = "",
|
|
|
97 |
"an astronaut riding a horse in space",
|
98 |
"a cartoon of a boy playing with a tiger",
|
99 |
"a cute robot artist painting on an easel, concept art",
|
100 |
+
#"a close up of a woman wearing a transparent, prismatic, elaborate nemeses headdress, over the should pose, brown skin-to"
|
101 |
]
|
102 |
|
103 |
css = '''
|
104 |
.gradio-container{max-width: 560px !important}
|
105 |
h1{text-align:center}
|
106 |
+
footer {
|
107 |
+
visibility: hidden
|
108 |
+
}
|
109 |
'''
|
110 |
with gr.Blocks(css=css) as demo:
|
111 |
+
gr.Markdown("""# SDXL Flash
|
112 |
+
### <span style='color: red;'>You may change the steps from 5 to 8, if you didn't get satisfied results.
|
113 |
+
### First Image processing takes time then images generate faster.""")
|
114 |
with gr.Group():
|
115 |
with gr.Row():
|
116 |
prompt = gr.Text(
|
|
|
121 |
container=False,
|
122 |
)
|
123 |
run_button = gr.Button("Run", scale=0)
|
124 |
+
result = gr.Gallery(label="Result")
|
125 |
with gr.Accordion("Advanced options", open=False):
|
126 |
with gr.Row():
|
127 |
use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True)
|
128 |
negative_prompt = gr.Text(
|
129 |
label="Negative prompt",
|
130 |
+
max_lines=5,
|
131 |
+
lines=4,
|
132 |
placeholder="Enter a negative prompt",
|
133 |
value="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, NSFW",
|
134 |
visible=True,
|