Spaces:
Runtime error
Runtime error
Commit
•
ca25d4d
1
Parent(s):
b819231
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from time import sleep
|
|
3 |
from diffusers import DiffusionPipeline
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
from safetensors.torch import load_file
|
|
|
6 |
|
7 |
import torch
|
8 |
import json
|
@@ -54,6 +55,15 @@ css = '''
|
|
54 |
.random_column{align-self: center; align-items: center}
|
55 |
@media (max-width: 1024px) {
|
56 |
.roulette_group{flex-direction: column}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
'''
|
59 |
|
@@ -124,9 +134,20 @@ with gr.Blocks(css=css) as demo:
|
|
124 |
with gr.Column(min_width=10, scale=14):
|
125 |
with gr.Box():
|
126 |
with gr.Row():
|
127 |
-
prompt = gr.Textbox(label="Your prompt", show_label=False, interactive=True, elem_id="prompt")
|
128 |
run_btn = gr.Button("Run", elem_id="run_button")
|
129 |
output_image = gr.Image(label="Output", height=355)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
|
132 |
|
@@ -143,6 +164,6 @@ with gr.Blocks(css=css) as demo:
|
|
143 |
|
144 |
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
145 |
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
146 |
-
|
147 |
demo.queue()
|
148 |
demo.launch()
|
|
|
3 |
from diffusers import DiffusionPipeline
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
from safetensors.torch import load_file
|
6 |
+
from share_btn import community_icon_html, loading_icon_html, share_js
|
7 |
|
8 |
import torch
|
9 |
import json
|
|
|
55 |
.random_column{align-self: center; align-items: center}
|
56 |
@media (max-width: 1024px) {
|
57 |
.roulette_group{flex-direction: column}
|
58 |
+
|
59 |
+
#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;}
|
60 |
+
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
61 |
+
#share-btn-container:hover {background-color: #060606}
|
62 |
+
#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;}
|
63 |
+
#share-btn * {all: unset}
|
64 |
+
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
65 |
+
#share-btn-container .wrap {display: none !important}
|
66 |
+
#share-btn-container.hidden {display: none!important}
|
67 |
}
|
68 |
'''
|
69 |
|
|
|
134 |
with gr.Column(min_width=10, scale=14):
|
135 |
with gr.Box():
|
136 |
with gr.Row():
|
137 |
+
prompt = gr.Textbox(label="Your prompt", info="rearrange the trigger words into a coherent prompt!", show_label=False, interactive=True, elem_id="prompt")
|
138 |
run_btn = gr.Button("Run", elem_id="run_button")
|
139 |
output_image = gr.Image(label="Output", height=355)
|
140 |
+
with gr.Row():
|
141 |
+
with gr.Column():
|
142 |
+
gr.Button("👍")
|
143 |
+
with gr.Column():
|
144 |
+
gr.Button("👎")
|
145 |
+
with gr.Column():
|
146 |
+
with gr.Group(elem_id="share-btn-container") as share_group:
|
147 |
+
community_icon = gr.HTML(community_icon_html)
|
148 |
+
loading_icon = gr.HTML(loading_icon_html)
|
149 |
+
share_button = gr.Button("Share to community", elem_id="share-btn")
|
150 |
+
|
151 |
|
152 |
|
153 |
|
|
|
164 |
|
165 |
run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
166 |
prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
|
167 |
+
share_button.click(None, [], [], _js=share_js)
|
168 |
demo.queue()
|
169 |
demo.launch()
|