Spaces:
Running
on
Zero
Running
on
Zero
adamelliotfields
commited on
Commit
•
459aacb
1
Parent(s):
bd8e953
Menu improvements
Browse files
app.css
CHANGED
@@ -19,6 +19,10 @@
|
|
19 |
--block-border-width: 1px;
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
22 |
.gallery {
|
23 |
background-color: var(--bg);
|
24 |
}
|
@@ -30,11 +34,11 @@
|
|
30 |
}
|
31 |
.gallery, .gallery > .grid-wrap {
|
32 |
height: 100%;
|
33 |
-
max-height:
|
34 |
}
|
35 |
@media (min-width: 640px) {
|
36 |
.gallery, .gallery > .grid-wrap {
|
37 |
-
height:
|
38 |
max-height: none;
|
39 |
}
|
40 |
}
|
@@ -105,7 +109,7 @@
|
|
105 |
border-width: 0px;
|
106 |
}
|
107 |
.tabitem {
|
108 |
-
max-height:
|
109 |
overflow-x: hidden;
|
110 |
overflow-y: auto;
|
111 |
padding: 0 0 8px;
|
|
|
19 |
--block-border-width: 1px;
|
20 |
}
|
21 |
|
22 |
+
#embeddings .token {
|
23 |
+
border-radius: 4px;
|
24 |
+
}
|
25 |
+
|
26 |
.gallery {
|
27 |
background-color: var(--bg);
|
28 |
}
|
|
|
34 |
}
|
35 |
.gallery, .gallery > .grid-wrap {
|
36 |
height: 100%;
|
37 |
+
max-height: 550px;
|
38 |
}
|
39 |
@media (min-width: 640px) {
|
40 |
.gallery, .gallery > .grid-wrap {
|
41 |
+
height: 550px;
|
42 |
max-height: none;
|
43 |
}
|
44 |
}
|
|
|
109 |
border-width: 0px;
|
110 |
}
|
111 |
.tabitem {
|
112 |
+
max-height: 656px;
|
113 |
overflow-x: hidden;
|
114 |
overflow-y: auto;
|
115 |
padding: 0 0 8px;
|
app.js
CHANGED
@@ -2,13 +2,15 @@
|
|
2 |
const menu = document.querySelector("#menu");
|
3 |
const menuButton = menu.querySelector("button");
|
4 |
const menuSpan = menuButton.querySelector("span:first-child");
|
|
|
5 |
|
6 |
-
const
|
7 |
const isOpen = menuButton.classList.contains("open");
|
8 |
-
menuSpan.textContent = isOpen ? "
|
|
|
9 |
};
|
10 |
|
11 |
-
const observer = new MutationObserver(
|
12 |
observer.observe(menuButton, { attributes: true, attributeFilter: ["class"] });
|
13 |
-
|
14 |
}
|
|
|
2 |
const menu = document.querySelector("#menu");
|
3 |
const menuButton = menu.querySelector("button");
|
4 |
const menuSpan = menuButton.querySelector("span:first-child");
|
5 |
+
const content = document.querySelector("#content");
|
6 |
|
7 |
+
const updateMenu = () => {
|
8 |
const isOpen = menuButton.classList.contains("open");
|
9 |
+
menuSpan.textContent = isOpen ? "Hide menu" : "Show menu";
|
10 |
+
content.style.display = isOpen ? "none" : "flex";
|
11 |
};
|
12 |
|
13 |
+
const observer = new MutationObserver(updateMenu);
|
14 |
observer.observe(menuButton, { attributes: true, attributeFilter: ["class"] });
|
15 |
+
updateMenu();
|
16 |
}
|
app.py
CHANGED
@@ -87,7 +87,7 @@ with gr.Blocks(
|
|
87 |
with gr.Accordion(
|
88 |
elem_classes=["accordion"],
|
89 |
elem_id="menu",
|
90 |
-
label="
|
91 |
open=False,
|
92 |
):
|
93 |
with gr.Tabs():
|
@@ -106,6 +106,7 @@ with gr.Blocks(
|
|
106 |
filterable=False,
|
107 |
value=Config.MODEL,
|
108 |
label="Model",
|
|
|
109 |
)
|
110 |
scheduler = gr.Dropdown(
|
111 |
choices=Config.SCHEDULERS,
|
@@ -120,14 +121,15 @@ with gr.Blocks(
|
|
120 |
style = gr.Dropdown(
|
121 |
value=Config.STYLE,
|
122 |
label="Style",
|
123 |
-
min_width=200,
|
124 |
choices=[("None", None)] + [(s["name"], s["id"]) for s in styles],
|
125 |
)
|
126 |
embeddings = gr.Dropdown(
|
|
|
127 |
label="Embeddings",
|
128 |
choices=[(f"<{e}>", e) for e in Config.EMBEDDINGS],
|
129 |
multiselect=True,
|
130 |
value=[Config.EMBEDDING],
|
|
|
131 |
)
|
132 |
|
133 |
with gr.Row():
|
@@ -179,7 +181,6 @@ with gr.Blocks(
|
|
179 |
value="448,576",
|
180 |
filterable=False,
|
181 |
label="Aspect Ratio",
|
182 |
-
min_width=180,
|
183 |
)
|
184 |
scale = gr.Dropdown(
|
185 |
choices=[(f"{s}x", s) for s in Config.SCALES],
|
@@ -253,49 +254,52 @@ with gr.Blocks(
|
|
253 |
with gr.TabItem("ℹ️ Usage"):
|
254 |
gr.Markdown(read_file("usage.md"), elem_classes=["markdown"])
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
variant="
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
299 |
|
300 |
random_btn.click(random_fn, inputs=[], outputs=[prompt], show_api=False)
|
301 |
|
|
|
87 |
with gr.Accordion(
|
88 |
elem_classes=["accordion"],
|
89 |
elem_id="menu",
|
90 |
+
label="Show menu",
|
91 |
open=False,
|
92 |
):
|
93 |
with gr.Tabs():
|
|
|
106 |
filterable=False,
|
107 |
value=Config.MODEL,
|
108 |
label="Model",
|
109 |
+
min_width=240,
|
110 |
)
|
111 |
scheduler = gr.Dropdown(
|
112 |
choices=Config.SCHEDULERS,
|
|
|
121 |
style = gr.Dropdown(
|
122 |
value=Config.STYLE,
|
123 |
label="Style",
|
|
|
124 |
choices=[("None", None)] + [(s["name"], s["id"]) for s in styles],
|
125 |
)
|
126 |
embeddings = gr.Dropdown(
|
127 |
+
elem_id="embeddings",
|
128 |
label="Embeddings",
|
129 |
choices=[(f"<{e}>", e) for e in Config.EMBEDDINGS],
|
130 |
multiselect=True,
|
131 |
value=[Config.EMBEDDING],
|
132 |
+
min_width=240,
|
133 |
)
|
134 |
|
135 |
with gr.Row():
|
|
|
181 |
value="448,576",
|
182 |
filterable=False,
|
183 |
label="Aspect Ratio",
|
|
|
184 |
)
|
185 |
scale = gr.Dropdown(
|
186 |
choices=[(f"{s}x", s) for s in Config.SCALES],
|
|
|
254 |
with gr.TabItem("ℹ️ Usage"):
|
255 |
gr.Markdown(read_file("usage.md"), elem_classes=["markdown"])
|
256 |
|
257 |
+
# Main content
|
258 |
+
with gr.Column(elem_id="content"):
|
259 |
+
with gr.Group():
|
260 |
+
output_images = gr.Gallery(
|
261 |
+
elem_classes=["gallery"],
|
262 |
+
show_share_button=False,
|
263 |
+
interactive=False,
|
264 |
+
show_label=False,
|
265 |
+
object_fit="cover",
|
266 |
+
label="Output",
|
267 |
+
format="png",
|
268 |
+
columns=2,
|
269 |
+
)
|
270 |
+
prompt = gr.Textbox(
|
271 |
+
placeholder="corgi, beach, 8k",
|
272 |
+
show_label=False,
|
273 |
+
label="Prompt",
|
274 |
+
value=None,
|
275 |
+
lines=2,
|
276 |
+
)
|
277 |
+
|
278 |
+
# Buttons
|
279 |
+
with gr.Row():
|
280 |
+
generate_btn = gr.Button("Generate", variant="primary")
|
281 |
+
random_btn = gr.Button(
|
282 |
+
elem_classes=["icon-button", "popover"],
|
283 |
+
variant="secondary",
|
284 |
+
elem_id="random",
|
285 |
+
min_width=0,
|
286 |
+
value="🎲",
|
287 |
+
)
|
288 |
+
refresh_btn = gr.Button(
|
289 |
+
elem_classes=["icon-button", "popover"],
|
290 |
+
variant="secondary",
|
291 |
+
elem_id="refresh",
|
292 |
+
min_width=0,
|
293 |
+
value="🔄",
|
294 |
+
)
|
295 |
+
clear_btn = gr.ClearButton(
|
296 |
+
elem_classes=["icon-button", "popover"],
|
297 |
+
components=[output_images],
|
298 |
+
variant="secondary",
|
299 |
+
elem_id="clear",
|
300 |
+
min_width=0,
|
301 |
+
value="🗑️",
|
302 |
+
)
|
303 |
|
304 |
random_btn.click(random_fn, inputs=[], outputs=[prompt], show_api=False)
|
305 |
|
partials/head.html
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<style>
|
2 |
/* gradio styles go in head */
|
3 |
-
@media (min-width:
|
4 |
gradio-app > .gradio-container {
|
5 |
-
max-width:
|
6 |
}
|
7 |
}
|
8 |
</style>
|
|
|
1 |
<style>
|
2 |
/* gradio styles go in head */
|
3 |
+
@media (min-width: 1536px) {
|
4 |
gradio-app > .gradio-container {
|
5 |
+
max-width: 1280px !important;
|
6 |
}
|
7 |
}
|
8 |
</style>
|