Spaces:
Runtime error
Runtime error
simpify the ui
Browse files- app.py +34 -14
- chat_interface.py +4 -4
app.py
CHANGED
@@ -31,7 +31,7 @@ from chat_interface import ChatInterface
|
|
31 |
from transformers.generation.stopping_criteria import StoppingCriteriaList
|
32 |
|
33 |
import lib_omost.canvas as omost_canvas
|
34 |
-
|
35 |
|
36 |
# SDXL
|
37 |
|
@@ -285,18 +285,30 @@ from gradio.themes.utils import colors
|
|
285 |
|
286 |
with gr.Blocks(
|
287 |
fill_height=True, css=css,
|
288 |
-
theme=gr.themes.
|
289 |
) as demo:
|
|
|
|
|
|
|
|
|
290 |
with gr.Row(elem_classes='outer_parent'):
|
291 |
with gr.Column(scale=25):
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
with gr.Row():
|
293 |
clear_btn = gr.Button("➕ New Chat", variant="secondary", size="sm", min_width=60)
|
294 |
retry_btn = gr.Button("Retry", variant="secondary", size="sm", min_width=60, visible=False)
|
295 |
undo_btn = gr.Button("✏️️ Edit Last Input", variant="secondary", size="sm", min_width=60, interactive=False)
|
296 |
|
297 |
-
seed = gr.Number(label="Random Seed", value=123456, precision=0)
|
298 |
|
299 |
-
|
|
|
|
|
|
|
300 |
with gr.Group():
|
301 |
with gr.Row():
|
302 |
temperature = gr.Slider(
|
@@ -317,40 +329,48 @@ with gr.Blocks(
|
|
317 |
step=1,
|
318 |
value=4096,
|
319 |
label="Max New Tokens")
|
320 |
-
with gr.Accordion(open=
|
321 |
with gr.Group():
|
322 |
with gr.Row():
|
323 |
image_width = gr.Slider(label="Image Width", minimum=256, maximum=2048, value=896, step=64)
|
324 |
image_height = gr.Slider(label="Image Height", minimum=256, maximum=2048, value=1152, step=64)
|
325 |
|
326 |
-
with gr.Row():
|
327 |
num_samples = gr.Slider(label="Image Number", minimum=1, maximum=12, value=1, step=1)
|
328 |
steps = gr.Slider(label="Sampling Steps", minimum=1, maximum=100, value=25, step=1)
|
329 |
|
330 |
with gr.Accordion(open=False, label='Advanced'):
|
|
|
331 |
cfg = gr.Slider(label="CFG Scale", minimum=1.0, maximum=32.0, value=5.0, step=0.01)
|
332 |
highres_scale = gr.Slider(label="HR-fix Scale (\"1\" is disabled)", minimum=1.0, maximum=2.0, value=1.0, step=0.01)
|
333 |
highres_steps = gr.Slider(label="Highres Fix Steps", minimum=1, maximum=100, value=20, step=1)
|
334 |
highres_denoise = gr.Slider(label="Highres Fix Denoise", minimum=0.1, maximum=1.0, value=0.4, step=0.01)
|
335 |
n_prompt = gr.Textbox(label="Negative Prompt", value='lowres, bad anatomy, bad hands, cropped, worst quality')
|
336 |
|
337 |
-
|
338 |
|
339 |
examples = gr.Dataset(
|
340 |
samples=[
|
341 |
['generate an image of the fierce battle of warriors and the dragon'],
|
342 |
-
['change the dragon to a dinosaur']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
],
|
344 |
components=[gr.Textbox(visible=False)],
|
345 |
label='Quick Prompts'
|
346 |
)
|
347 |
|
348 |
-
|
349 |
-
|
350 |
-
with gr.Row():
|
351 |
-
gr.Markdown("Local version (8GB VRAM): https://github.com/lllyasviel/Omost")
|
352 |
-
# with gr.Row():
|
353 |
-
# gr.Markdown("Hint: You can [duplicate this space](https://huggingface.co/spaces/lllyasviel/Omost?duplicate=true) to your private account to bypass the waiting queue.")
|
354 |
|
355 |
with gr.Column(scale=75, elem_classes='inner_parent'):
|
356 |
canvas_state = gr.State(None)
|
|
|
31 |
from transformers.generation.stopping_criteria import StoppingCriteriaList
|
32 |
|
33 |
import lib_omost.canvas as omost_canvas
|
34 |
+
import random
|
35 |
|
36 |
# SDXL
|
37 |
|
|
|
285 |
|
286 |
with gr.Blocks(
|
287 |
fill_height=True, css=css,
|
288 |
+
theme=gr.themes.Soft()
|
289 |
) as demo:
|
290 |
+
with gr.Row():
|
291 |
+
gr.Markdown("""# Omost: Your image is almost there!
|
292 |
+
### Converting LLM's coding capability to image compositing capability.
|
293 |
+
""")
|
294 |
with gr.Row(elem_classes='outer_parent'):
|
295 |
with gr.Column(scale=25):
|
296 |
+
|
297 |
+
# with gr.Row():
|
298 |
+
# gr.Markdown("Local version (8GB VRAM): https://github.com/lllyasviel/Omost")
|
299 |
+
# with gr.Row():
|
300 |
+
# gr.Markdown("Hint: You can [duplicate this space](https://huggingface.co/spaces/lllyasviel/Omost?duplicate=true) to your private account to bypass the waiting queue.")
|
301 |
+
|
302 |
with gr.Row():
|
303 |
clear_btn = gr.Button("➕ New Chat", variant="secondary", size="sm", min_width=60)
|
304 |
retry_btn = gr.Button("Retry", variant="secondary", size="sm", min_width=60, visible=False)
|
305 |
undo_btn = gr.Button("✏️️ Edit Last Input", variant="secondary", size="sm", min_width=60, interactive=False)
|
306 |
|
|
|
307 |
|
308 |
+
r_value = random.randint(1, 9999999)
|
309 |
+
|
310 |
+
|
311 |
+
with gr.Accordion(open=True, label='Language Model', visible=False):
|
312 |
with gr.Group():
|
313 |
with gr.Row():
|
314 |
temperature = gr.Slider(
|
|
|
329 |
step=1,
|
330 |
value=4096,
|
331 |
label="Max New Tokens")
|
332 |
+
with gr.Accordion(open=False, label='Image Resolution'):
|
333 |
with gr.Group():
|
334 |
with gr.Row():
|
335 |
image_width = gr.Slider(label="Image Width", minimum=256, maximum=2048, value=896, step=64)
|
336 |
image_height = gr.Slider(label="Image Height", minimum=256, maximum=2048, value=1152, step=64)
|
337 |
|
338 |
+
with gr.Row(visible=False):
|
339 |
num_samples = gr.Slider(label="Image Number", minimum=1, maximum=12, value=1, step=1)
|
340 |
steps = gr.Slider(label="Sampling Steps", minimum=1, maximum=100, value=25, step=1)
|
341 |
|
342 |
with gr.Accordion(open=False, label='Advanced'):
|
343 |
+
seed = gr.Number(label="Random Seed", value=r_value, precision=0)
|
344 |
cfg = gr.Slider(label="CFG Scale", minimum=1.0, maximum=32.0, value=5.0, step=0.01)
|
345 |
highres_scale = gr.Slider(label="HR-fix Scale (\"1\" is disabled)", minimum=1.0, maximum=2.0, value=1.0, step=0.01)
|
346 |
highres_steps = gr.Slider(label="Highres Fix Steps", minimum=1, maximum=100, value=20, step=1)
|
347 |
highres_denoise = gr.Slider(label="Highres Fix Denoise", minimum=0.1, maximum=1.0, value=0.4, step=0.01)
|
348 |
n_prompt = gr.Textbox(label="Negative Prompt", value='lowres, bad anatomy, bad hands, cropped, worst quality')
|
349 |
|
350 |
+
|
351 |
|
352 |
examples = gr.Dataset(
|
353 |
samples=[
|
354 |
['generate an image of the fierce battle of warriors and the dragon'],
|
355 |
+
['change the dragon to a dinosaur'],
|
356 |
+
['a beautiful girl in a futuristic cyberpunk'],
|
357 |
+
['girl, sexy, collarbone, wavy hair, looking at viewer'],
|
358 |
+
['close up photo of a rabbit'],
|
359 |
+
['a tattoo design, a small bird'],
|
360 |
+
['a master jedi cat in star wars holding a lightsaber'],
|
361 |
+
['adorable concept illustration of a plush animal peacefully sitting on a child’s bed'],
|
362 |
+
['portrait of a pretty blonde woman, a flower crown, earthy makeup'],
|
363 |
+
['从前有座山,山里有座庙,庙里有个老和尚'],
|
364 |
+
|
365 |
+
|
366 |
+
|
367 |
],
|
368 |
components=[gr.Textbox(visible=False)],
|
369 |
label='Quick Prompts'
|
370 |
)
|
371 |
|
372 |
+
render_button = gr.Button("Render the Image!", size='lg', variant="primary", visible=False)
|
373 |
+
|
|
|
|
|
|
|
|
|
374 |
|
375 |
with gr.Column(scale=75, elem_classes='inner_parent'):
|
376 |
canvas_state = gr.State(None)
|
chat_interface.py
CHANGED
@@ -184,8 +184,8 @@ class ChatInterface(Blocks):
|
|
184 |
submit_btn = None
|
185 |
self.textbox = MultimodalTextbox(
|
186 |
show_label=False,
|
187 |
-
label="
|
188 |
-
placeholder="
|
189 |
scale=7,
|
190 |
autofocus=autofocus,
|
191 |
)
|
@@ -193,8 +193,8 @@ class ChatInterface(Blocks):
|
|
193 |
self.textbox = Textbox(
|
194 |
container=False,
|
195 |
show_label=False,
|
196 |
-
label="
|
197 |
-
placeholder="
|
198 |
scale=7,
|
199 |
autofocus=autofocus,
|
200 |
)
|
|
|
184 |
submit_btn = None
|
185 |
self.textbox = MultimodalTextbox(
|
186 |
show_label=False,
|
187 |
+
label="Prompt",
|
188 |
+
placeholder="What do you want to draw?",
|
189 |
scale=7,
|
190 |
autofocus=autofocus,
|
191 |
)
|
|
|
193 |
self.textbox = Textbox(
|
194 |
container=False,
|
195 |
show_label=False,
|
196 |
+
label="Prompt",
|
197 |
+
placeholder="What do you want to draw?",
|
198 |
scale=7,
|
199 |
autofocus=autofocus,
|
200 |
)
|