Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,13 +67,13 @@ def generate(prompt,
|
|
| 67 |
total_images=[],
|
| 68 |
progress=gr.Progress()
|
| 69 |
):
|
| 70 |
-
progress(0, desc="Calculating directions...")
|
| 71 |
slider_x = [concept_2, concept_1]
|
| 72 |
# check if avg diff for directions need to be re-calculated
|
| 73 |
if randomize_seed:
|
| 74 |
seed = random.randint(0, MAX_SEED)
|
| 75 |
|
| 76 |
if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]) or recalc_directions:
|
|
|
|
| 77 |
avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations)
|
| 78 |
x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
|
| 79 |
|
|
@@ -133,8 +133,8 @@ intro = """
|
|
| 133 |
</p>
|
| 134 |
"""
|
| 135 |
css='''
|
| 136 |
-
#strip, #video{max-height: 256px; min-height:
|
| 137 |
-
#video .empty{min-height:
|
| 138 |
#strip img{object-fit: cover}
|
| 139 |
.gradio-container{max-width: 960px !important}
|
| 140 |
'''
|
|
@@ -167,14 +167,14 @@ with gr.Blocks(css=css) as demo:
|
|
| 167 |
post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1, label="From 1st to 2nd direction")
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Column(scale=4):
|
| 170 |
-
image_seq = gr.Image(label="Strip", elem_id="strip", height=
|
| 171 |
with gr.Column(scale=2, min_width=100):
|
| 172 |
output_image = gr.Video(label="Looping video", elem_id="video", loop=True, autoplay=True)
|
| 173 |
with gr.Accordion(label="Advanced options", open=False):
|
| 174 |
interm_steps = gr.Slider(label = "Num of intermediate images", minimum=3, value=7, maximum=65, step=2)
|
| 175 |
with gr.Row():
|
| 176 |
-
iterations = gr.Slider(label = "Num iterations for clip directions", minimum=0, value=200, maximum=
|
| 177 |
-
steps = gr.Slider(label = "Num inference steps", minimum=1, value=3, maximum=
|
| 178 |
with gr.Row():
|
| 179 |
guidance_scale = gr.Slider(
|
| 180 |
label="Guidance scale",
|
|
|
|
| 67 |
total_images=[],
|
| 68 |
progress=gr.Progress()
|
| 69 |
):
|
|
|
|
| 70 |
slider_x = [concept_2, concept_1]
|
| 71 |
# check if avg diff for directions need to be re-calculated
|
| 72 |
if randomize_seed:
|
| 73 |
seed = random.randint(0, MAX_SEED)
|
| 74 |
|
| 75 |
if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]) or recalc_directions:
|
| 76 |
+
progress(0, desc="Calculating directions...")
|
| 77 |
avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations)
|
| 78 |
x_concept_1, x_concept_2 = slider_x[0], slider_x[1]
|
| 79 |
|
|
|
|
| 133 |
</p>
|
| 134 |
"""
|
| 135 |
css='''
|
| 136 |
+
#strip, #video{max-height: 256px; min-height: 80px}
|
| 137 |
+
#video .empty{min-height: 80px}
|
| 138 |
#strip img{object-fit: cover}
|
| 139 |
.gradio-container{max-width: 960px !important}
|
| 140 |
'''
|
|
|
|
| 167 |
post_generation_slider = gr.Slider(minimum=-10, maximum=10, value=0, step=1, label="From 1st to 2nd direction")
|
| 168 |
with gr.Row():
|
| 169 |
with gr.Column(scale=4):
|
| 170 |
+
image_seq = gr.Image(label="Strip", elem_id="strip", height=80)
|
| 171 |
with gr.Column(scale=2, min_width=100):
|
| 172 |
output_image = gr.Video(label="Looping video", elem_id="video", loop=True, autoplay=True)
|
| 173 |
with gr.Accordion(label="Advanced options", open=False):
|
| 174 |
interm_steps = gr.Slider(label = "Num of intermediate images", minimum=3, value=7, maximum=65, step=2)
|
| 175 |
with gr.Row():
|
| 176 |
+
iterations = gr.Slider(label = "Num iterations for clip directions", minimum=0, value=200, maximum=400, step=1)
|
| 177 |
+
steps = gr.Slider(label = "Num inference steps", minimum=1, value=3, maximum=4, step=1)
|
| 178 |
with gr.Row():
|
| 179 |
guidance_scale = gr.Slider(
|
| 180 |
label="Guidance scale",
|