Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -130,6 +130,14 @@ css = '''
|
|
| 130 |
#image_out{position:absolute; width: 80%; right: 10px; top: 40px}
|
| 131 |
'''
|
| 132 |
with gr.Blocks(css=css) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
x_concept_1 = gr.State("")
|
| 135 |
x_concept_2 = gr.State("")
|
|
@@ -141,39 +149,39 @@ with gr.Blocks(css=css) as demo:
|
|
| 141 |
|
| 142 |
recalc_directions = gr.State(False)
|
| 143 |
|
| 144 |
-
with gr.Tab("text2image"):
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
|
| 178 |
|
| 179 |
# with gr.Tab(label="image2image"):
|
|
|
|
| 130 |
#image_out{position:absolute; width: 80%; right: 10px; top: 40px}
|
| 131 |
'''
|
| 132 |
with gr.Blocks(css=css) as demo:
|
| 133 |
+
gr.Markdown("""
|
| 134 |
+
<div style="text-align: center; font-size: 28px; font-weight: bold; margin-bottom: 20px;">
|
| 135 |
+
Latent Navigation
|
| 136 |
+
</div>
|
| 137 |
+
<div style="text-align: center; font-size: 16px; margin-bottom: 20px;">
|
| 138 |
+
Explorations in CLIP Space 🪐
|
| 139 |
+
</div>
|
| 140 |
+
""")
|
| 141 |
|
| 142 |
x_concept_1 = gr.State("")
|
| 143 |
x_concept_2 = gr.State("")
|
|
|
|
| 149 |
|
| 150 |
recalc_directions = gr.State(False)
|
| 151 |
|
| 152 |
+
#with gr.Tab("text2image"):
|
| 153 |
+
with gr.Row():
|
| 154 |
+
with gr.Column():
|
| 155 |
+
slider_x = gr.Dropdown(label="Slider concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
| 156 |
+
#slider_y = gr.Dropdown(label="Slider Y concept range", allow_custom_value=True, multiselect=True, max_choices=2)
|
| 157 |
+
prompt = gr.Textbox(label="Prompt")
|
| 158 |
+
submit = gr.Button("find directions")
|
| 159 |
+
with gr.Column():
|
| 160 |
+
with gr.Group(elem_id="group"):
|
| 161 |
+
x = gr.Slider(minimum=-3, value=0, maximum=3.5, elem_id="x", interactive=False)
|
| 162 |
+
#y = gr.Slider(minimum=-10, value=0, maximum=10, elem_id="y", interactive=False)
|
| 163 |
+
output_image = gr.Image(elem_id="image_out")
|
| 164 |
+
# with gr.Row():
|
| 165 |
+
# generate_butt = gr.Button("generate")
|
| 166 |
+
|
| 167 |
+
with gr.Accordion(label="advanced options", open=False):
|
| 168 |
+
iterations = gr.Slider(label = "num iterations", minimum=0, value=200, maximum=400)
|
| 169 |
+
steps = gr.Slider(label = "num inference steps", minimum=1, value=4, maximum=10)
|
| 170 |
+
guidance_scale = gr.Slider(
|
| 171 |
+
label="Guidance scale",
|
| 172 |
+
minimum=0.1,
|
| 173 |
+
maximum=10.0,
|
| 174 |
+
step=0.1,
|
| 175 |
+
value=5,
|
| 176 |
+
)
|
| 177 |
+
# correlation = gr.Slider(
|
| 178 |
+
# label="correlation",
|
| 179 |
+
# minimum=0.1,
|
| 180 |
+
# maximum=1.0,
|
| 181 |
+
# step=0.05,
|
| 182 |
+
# value=0.6,
|
| 183 |
+
# )
|
| 184 |
+
seed = gr.Slider(minimum=0, maximum=np.iinfo(np.int32).max, label="Seed", interactive=True, randomize=True)
|
| 185 |
|
| 186 |
|
| 187 |
# with gr.Tab(label="image2image"):
|