Update app.py
Browse files
app.py
CHANGED
|
@@ -69,11 +69,11 @@ def gen_fn(model_str, prompt, negative_prompt):
|
|
| 69 |
def make_me():
|
| 70 |
# with gr.Tab('The Dream'):
|
| 71 |
with gr.Row():
|
| 72 |
-
txt_input = gr.Textbox(lines=2, value=kii
|
| 73 |
#txt_input = gr.Textbox(label='Your prompt:', lines=2, value=kii)
|
| 74 |
-
negative_prompt_input = gr.Textbox(lines=2, value="", label="Negative Prompt"
|
| 75 |
-
gen_button = gr.Button('Generate images'
|
| 76 |
-
stop_button = gr.Button('Stop', variant='secondary', interactive=False
|
| 77 |
gen_button.click(lambda s: gr.update(interactive=True), None, stop_button)
|
| 78 |
gr.HTML("""
|
| 79 |
<div style="text-align: center; max-width: 100%; margin: 0 auto;">
|
|
@@ -82,16 +82,22 @@ def make_me():
|
|
| 82 |
</div>
|
| 83 |
""")
|
| 84 |
with gr.Row():
|
| 85 |
-
output = [gr.Image(label=m
|
| 86 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 87 |
for m, o in zip(current_models, output):
|
| 88 |
gen_event = gen_button.click(gen_fn, [m, txt_input, negative_prompt_input], o)
|
| 89 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
# model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
| 92 |
# model_choice.change(update_imgbox, model_choice, output)
|
| 93 |
# model_choice.change(extend_choices, model_choice, current_models)
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
# gr.HTML("""
|
| 96 |
# <div class="footer">
|
| 97 |
# <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77 and Omnibus's Maximum Multiplier!
|
|
@@ -114,11 +120,15 @@ js_code = """
|
|
| 114 |
"""
|
| 115 |
|
| 116 |
|
| 117 |
-
with gr.Blocks(css="div.float.svelte-1mwvhlq { position: absolute; top: var(--block-label-margin); left: var(--block-label-margin); background: none; border: none;}") as demo:
|
| 118 |
-
gr.Markdown("<div></div>")
|
| 119 |
-
make_me()
|
| 120 |
-
gr.Markdown(js_code)
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
demo.queue(
|
| 124 |
-
demo.launch()
|
|
|
|
| 69 |
def make_me():
|
| 70 |
# with gr.Tab('The Dream'):
|
| 71 |
with gr.Row():
|
| 72 |
+
txt_input = gr.Textbox(lines=2, value=kii )
|
| 73 |
#txt_input = gr.Textbox(label='Your prompt:', lines=2, value=kii)
|
| 74 |
+
negative_prompt_input = gr.Textbox(lines=2, value="", label="Negative Prompt" )
|
| 75 |
+
gen_button = gr.Button('Generate images')
|
| 76 |
+
stop_button = gr.Button('Stop', variant='secondary', interactive=False)
|
| 77 |
gen_button.click(lambda s: gr.update(interactive=True), None, stop_button)
|
| 78 |
gr.HTML("""
|
| 79 |
<div style="text-align: center; max-width: 100%; margin: 0 auto;">
|
|
|
|
| 82 |
</div>
|
| 83 |
""")
|
| 84 |
with gr.Row():
|
| 85 |
+
output = [gr.Image(label=m ) for m in default_models]
|
| 86 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 87 |
for m, o in zip(current_models, output):
|
| 88 |
gen_event = gen_button.click(gen_fn, [m, txt_input, negative_prompt_input], o)
|
| 89 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
with gr.Accordion('Model selection'):
|
| 93 |
# model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
| 94 |
# model_choice.change(update_imgbox, model_choice, output)
|
| 95 |
# model_choice.change(extend_choices, model_choice, current_models)
|
| 96 |
+
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, interactive=True )
|
| 97 |
+
model_choice.change(update_imgbox, model_choice, output)
|
| 98 |
+
model_choice.change(extend_choices, model_choice, current_models)
|
| 99 |
+
|
| 100 |
+
# with gr.Row():
|
| 101 |
# gr.HTML("""
|
| 102 |
# <div class="footer">
|
| 103 |
# <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77 and Omnibus's Maximum Multiplier!
|
|
|
|
| 120 |
"""
|
| 121 |
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
+
with gr.Blocks(css="""
|
| 125 |
+
label.float.svelte-i3tvor { top:auto!important; bottom: 0; position: absolute; background: rgba(0,0,0,0.0); left: var(--block-label-margin); color: rgba(200,200,200,.7);}
|
| 126 |
+
.genbut { max-width: 50px; max-height: 30px; width:150px; height:30px}
|
| 127 |
+
.stopbut { max-width: 50px; max-height: 30px; width:150px; height:30px}
|
| 128 |
+
.float.svelte-1mwvhlq { position: absolute; top: var(--block-label-margin); left: var(--block-label-margin); background: none; border: none;}
|
| 129 |
+
""") as demo:
|
| 130 |
+
gr.Markdown("<script>" + js_code + "</script>")
|
| 131 |
+
make_me()
|
| 132 |
|
| 133 |
+
demo.queue()
|
| 134 |
+
demo.launch(max_threads=200 )
|