Spaces:
Runtime error
Runtime error
Commit
β’
7d4e0fa
1
Parent(s):
a72bb25
Update app.py
Browse files
app.py
CHANGED
@@ -23,20 +23,15 @@ pipe.transformer.to(memory_format=torch.channels_last)
|
|
23 |
# pipe.enable_model_cpu_offload()
|
24 |
clip_slider = CLIPSliderFlux(pipe, device=torch.device("cuda"))
|
25 |
|
26 |
-
|
27 |
MAX_SEED = 2**32-1
|
28 |
|
29 |
def convert_to_centered_scale(num):
|
30 |
-
if num <= 0:
|
31 |
-
raise ValueError("Input must be a positive integer")
|
32 |
-
|
33 |
if num % 2 == 0: # even
|
34 |
start = -(num // 2 - 1)
|
35 |
end = num // 2
|
36 |
else: # odd
|
37 |
start = -(num // 2)
|
38 |
-
end = num // 2
|
39 |
-
|
40 |
return tuple(range(start, end + 1))
|
41 |
|
42 |
@spaces.GPU(duration=200)
|
@@ -126,11 +121,6 @@ css='''
|
|
126 |
#strip, #gif{max-height: 170px}
|
127 |
'''
|
128 |
examples = [["a dog in the park", "winter", "summer", 1.25], ["a house", "USA suburb", "Europe", 2], ["a tomato", "rotten", "super fresh", 2]]
|
129 |
-
image_seq = gr.Image(label="Strip", elem_id="strip", height=65)
|
130 |
-
output_image = gr.Image(label="Gif", elem_id="gif")
|
131 |
-
post_generation_image = gr.Image(label="Generated Images")
|
132 |
-
post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1)
|
133 |
-
seed = gr.Slider(minimum=0, maximum=MAX_SEED, step=1, label="Seed", interactive=True, randomize=True)
|
134 |
|
135 |
with gr.Blocks(css=css) as demo:
|
136 |
|
@@ -155,14 +145,14 @@ with gr.Blocks(css=css) as demo:
|
|
155 |
|
156 |
with gr.Column():
|
157 |
with gr.Group(elem_id="group"):
|
158 |
-
post_generation_image.
|
159 |
-
post_generation_slider.
|
160 |
with gr.Row():
|
161 |
with gr.Column(scale=4, min_width=50):
|
162 |
-
image_seq.
|
163 |
|
164 |
with gr.Column(scale=2, min_width=50):
|
165 |
-
output_image.
|
166 |
|
167 |
with gr.Accordion(label="Advanced options", open=False):
|
168 |
interm_steps = gr.Slider(label = "Num of intermediate images", minimum=3, value=21, maximum=65, step=2)
|
@@ -179,7 +169,7 @@ with gr.Blocks(css=css) as demo:
|
|
179 |
)
|
180 |
with gr.Column():
|
181 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
182 |
-
seed.
|
183 |
|
184 |
examples_gradio = gr.Examples(
|
185 |
examples=examples,
|
|
|
23 |
# pipe.enable_model_cpu_offload()
|
24 |
clip_slider = CLIPSliderFlux(pipe, device=torch.device("cuda"))
|
25 |
|
|
|
26 |
MAX_SEED = 2**32-1
|
27 |
|
28 |
def convert_to_centered_scale(num):
|
|
|
|
|
|
|
29 |
if num % 2 == 0: # even
|
30 |
start = -(num // 2 - 1)
|
31 |
end = num // 2
|
32 |
else: # odd
|
33 |
start = -(num // 2)
|
34 |
+
end = num // 2
|
|
|
35 |
return tuple(range(start, end + 1))
|
36 |
|
37 |
@spaces.GPU(duration=200)
|
|
|
121 |
#strip, #gif{max-height: 170px}
|
122 |
'''
|
123 |
examples = [["a dog in the park", "winter", "summer", 1.25], ["a house", "USA suburb", "Europe", 2], ["a tomato", "rotten", "super fresh", 2]]
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
with gr.Blocks(css=css) as demo:
|
126 |
|
|
|
145 |
|
146 |
with gr.Column():
|
147 |
with gr.Group(elem_id="group"):
|
148 |
+
post_generation_image = gr.Image(label="Generated Images")
|
149 |
+
post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1)
|
150 |
with gr.Row():
|
151 |
with gr.Column(scale=4, min_width=50):
|
152 |
+
image_seq = gr.Image(label="Strip", elem_id="strip", height=65)
|
153 |
|
154 |
with gr.Column(scale=2, min_width=50):
|
155 |
+
output_image = gr.Image(label="Gif", elem_id="gif")
|
156 |
|
157 |
with gr.Accordion(label="Advanced options", open=False):
|
158 |
interm_steps = gr.Slider(label = "Num of intermediate images", minimum=3, value=21, maximum=65, step=2)
|
|
|
169 |
)
|
170 |
with gr.Column():
|
171 |
randomize_seed = gr.Checkbox(True, label="Randomize seed")
|
172 |
+
seed = gr.Slider(minimum=0, maximum=MAX_SEED, step=1, label="Seed", interactive=True, randomize=True)
|
173 |
|
174 |
examples_gradio = gr.Examples(
|
175 |
examples=examples,
|