Spaces:
Runtime error
Runtime error
Commit
•
bc0b5e4
1
Parent(s):
e2ce734
Update app.py
Browse files
app.py
CHANGED
@@ -53,10 +53,10 @@ css = '''
|
|
53 |
#run_button{position:absolute;margin-top: 36px;right: 0;margin-right: 1.5em;border-bottom-left-radius: 0px;
|
54 |
border-top-left-radius: 0px;}
|
55 |
.random_column{align-self: center; align-items: center}
|
56 |
-
#share-btn-container{padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;}
|
57 |
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
58 |
#share-btn-container:hover {background-color: #060606}
|
59 |
-
#share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;}
|
60 |
#share-btn * {all: unset}
|
61 |
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
62 |
#share-btn-container .wrap {display: none !important}
|
@@ -83,7 +83,7 @@ def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lor
|
|
83 |
del pipe
|
84 |
gc.collect()
|
85 |
torch.cuda.empty_cache()
|
86 |
-
return image
|
87 |
|
88 |
def get_description(item):
|
89 |
trigger_word = item["trigger_word"]
|
@@ -133,21 +133,17 @@ with gr.Blocks(css=css) as demo:
|
|
133 |
prompt = gr.Textbox(label="Your prompt", info="rearrange the trigger words into a coherent prompt!", show_label=False, interactive=True, elem_id="prompt")
|
134 |
run_btn = gr.Button("Run", elem_id="run_button")
|
135 |
output_image = gr.Image(label="Output", height=355)
|
136 |
-
with gr.Row():
|
137 |
with gr.Column(min_width=10):
|
138 |
-
gr.Button("👍")
|
139 |
with gr.Column(min_width=10):
|
140 |
-
gr.Button("👎")
|
141 |
with gr.Column(min_width=10):
|
142 |
with gr.Group(elem_id="share-btn-container") as share_group:
|
143 |
community_icon = gr.HTML(community_icon_html)
|
144 |
loading_icon = gr.HTML(loading_icon_html)
|
145 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
with gr.Accordion("Advanced settings", open=False):
|
152 |
negative_prompt = gr.Textbox(label="Negative prompt")
|
153 |
with gr.Row():
|
@@ -158,8 +154,8 @@ with gr.Blocks(css=css) as demo:
|
|
158 |
demo.load(shuffle_images, inputs=[], outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
159 |
shuffle_button.click(shuffle_images, outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
160 |
|
161 |
-
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
162 |
-
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
163 |
share_button.click(None, [], [], _js=share_js)
|
164 |
demo.queue()
|
165 |
demo.launch()
|
|
|
53 |
#run_button{position:absolute;margin-top: 36px;right: 0;margin-right: 1.5em;border-bottom-left-radius: 0px;
|
54 |
border-top-left-radius: 0px;}
|
55 |
.random_column{align-self: center; align-items: center}
|
56 |
+
#share-btn-container{padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;margin-top: 0.35em;}
|
57 |
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
58 |
#share-btn-container:hover {background-color: #060606}
|
59 |
+
#share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;font-size: 15px;}
|
60 |
#share-btn * {all: unset}
|
61 |
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
62 |
#share-btn-container .wrap {display: none !important}
|
|
|
83 |
del pipe
|
84 |
gc.collect()
|
85 |
torch.cuda.empty_cache()
|
86 |
+
return image, gr.update(visible=True)
|
87 |
|
88 |
def get_description(item):
|
89 |
trigger_word = item["trigger_word"]
|
|
|
133 |
prompt = gr.Textbox(label="Your prompt", info="rearrange the trigger words into a coherent prompt!", show_label=False, interactive=True, elem_id="prompt")
|
134 |
run_btn = gr.Button("Run", elem_id="run_button")
|
135 |
output_image = gr.Image(label="Output", height=355)
|
136 |
+
with gr.Row(visible=False) as post_gen_info:
|
137 |
with gr.Column(min_width=10):
|
138 |
+
thumbs_up = gr.Button("👍")
|
139 |
with gr.Column(min_width=10):
|
140 |
+
thumbs_down = gr.Button("👎")
|
141 |
with gr.Column(min_width=10):
|
142 |
with gr.Group(elem_id="share-btn-container") as share_group:
|
143 |
community_icon = gr.HTML(community_icon_html)
|
144 |
loading_icon = gr.HTML(loading_icon_html)
|
145 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
146 |
+
|
|
|
|
|
|
|
|
|
147 |
with gr.Accordion("Advanced settings", open=False):
|
148 |
negative_prompt = gr.Textbox(label="Negative prompt")
|
149 |
with gr.Row():
|
|
|
154 |
demo.load(shuffle_images, inputs=[], outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
155 |
shuffle_button.click(shuffle_images, outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items, lora_1_scale, lora_2_scale], queue=False, show_progress="hidden")
|
156 |
|
157 |
+
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|
158 |
+
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info])
|
159 |
share_button.click(None, [], [], _js=share_js)
|
160 |
demo.queue()
|
161 |
demo.launch()
|