Commit
•
f1401e8
1
Parent(s):
f0ace4b
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from share_btn import community_icon_html, loading_icon_html, share_js
|
|
12 |
#word_list = word_list_dataset["train"]['text']
|
13 |
word_list = []
|
14 |
|
15 |
-
def infer(prompt, negative, scale):
|
16 |
for filter in word_list:
|
17 |
if re.search(rf"\b{filter}\b", prompt):
|
18 |
raise gr.Error("Unsafe content found. Please try again with different prompts.")
|
@@ -122,24 +122,14 @@ css = """
|
|
122 |
transform: rotate(360deg);
|
123 |
}
|
124 |
}
|
125 |
-
#share-btn-container {
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
}
|
130 |
-
#share-btn {
|
131 |
-
|
132 |
-
}
|
133 |
-
#share-btn * {
|
134 |
-
all: unset;
|
135 |
-
}
|
136 |
-
#share-btn-container div:nth-child(-n+2){
|
137 |
-
width: auto !important;
|
138 |
-
min-height: 0px !important;
|
139 |
-
}
|
140 |
-
#share-btn-container .wrap {
|
141 |
-
display: none !important;
|
142 |
-
}
|
143 |
|
144 |
.gr-form{
|
145 |
flex: 1 1 50%; border-top-right-radius: 0; border-bottom-right-radius: 0;
|
@@ -157,28 +147,28 @@ block = gr.Blocks(css=css)
|
|
157 |
examples = [
|
158 |
[
|
159 |
'A high tech solarpunk utopia in the Amazon rainforest',
|
160 |
-
|
161 |
-
|
162 |
],
|
163 |
[
|
164 |
'A pikachu fine dining with a view to the Eiffel Tower',
|
165 |
-
|
166 |
-
|
167 |
],
|
168 |
[
|
169 |
'A mecha robot in a favela in expressionist style',
|
170 |
-
|
171 |
-
|
172 |
],
|
173 |
[
|
174 |
'an insect robot preparing a delicious meal',
|
175 |
-
|
176 |
-
|
177 |
],
|
178 |
[
|
179 |
"A small cabin on top of a snowy mountain in the style of Disney, artstation",
|
180 |
-
|
181 |
-
|
182 |
],
|
183 |
]
|
184 |
|
@@ -253,8 +243,8 @@ with block:
|
|
253 |
btn = gr.Button("Generate", scale=0)
|
254 |
|
255 |
gallery = gr.Gallery(
|
256 |
-
label="Generated images", show_label=False, elem_id="gallery"
|
257 |
-
)
|
258 |
|
259 |
|
260 |
with gr.Group(elem_id="share-btn-container"):
|
@@ -275,7 +265,7 @@ with block:
|
|
275 |
)
|
276 |
|
277 |
ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_icon, loading_icon, share_button], cache_examples=False)
|
278 |
-
ex.dataset.headers = [""]
|
279 |
negative.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|
280 |
text.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|
281 |
btn.click(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|
|
|
12 |
#word_list = word_list_dataset["train"]['text']
|
13 |
word_list = []
|
14 |
|
15 |
+
def infer(prompt, negative="low_quality", scale=7):
|
16 |
for filter in word_list:
|
17 |
if re.search(rf"\b{filter}\b", prompt):
|
18 |
raise gr.Error("Unsafe content found. Please try again with different prompts.")
|
|
|
122 |
transform: rotate(360deg);
|
123 |
}
|
124 |
}
|
125 |
+
#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;}
|
126 |
+
div#share-btn-container > div {flex-direction: row;background: black;align-items: center}
|
127 |
+
#share-btn-container:hover {background-color: #060606}
|
128 |
+
#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;}
|
129 |
+
#share-btn * {all: unset}
|
130 |
+
#share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}
|
131 |
+
#share-btn-container .wrap {display: none !important}
|
132 |
+
#share-btn-container.hidden {display: none!important}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
.gr-form{
|
135 |
flex: 1 1 50%; border-top-right-radius: 0; border-bottom-right-radius: 0;
|
|
|
147 |
examples = [
|
148 |
[
|
149 |
'A high tech solarpunk utopia in the Amazon rainforest',
|
150 |
+
None,
|
151 |
+
None
|
152 |
],
|
153 |
[
|
154 |
'A pikachu fine dining with a view to the Eiffel Tower',
|
155 |
+
None,
|
156 |
+
None
|
157 |
],
|
158 |
[
|
159 |
'A mecha robot in a favela in expressionist style',
|
160 |
+
None,
|
161 |
+
None
|
162 |
],
|
163 |
[
|
164 |
'an insect robot preparing a delicious meal',
|
165 |
+
None,
|
166 |
+
None
|
167 |
],
|
168 |
[
|
169 |
"A small cabin on top of a snowy mountain in the style of Disney, artstation",
|
170 |
+
None,
|
171 |
+
None
|
172 |
],
|
173 |
]
|
174 |
|
|
|
243 |
btn = gr.Button("Generate", scale=0)
|
244 |
|
245 |
gallery = gr.Gallery(
|
246 |
+
label="Generated images", show_label=False, elem_id="gallery", grid=[2]
|
247 |
+
)
|
248 |
|
249 |
|
250 |
with gr.Group(elem_id="share-btn-container"):
|
|
|
265 |
)
|
266 |
|
267 |
ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative, guidance_scale], outputs=[gallery, community_icon, loading_icon, share_button], cache_examples=False)
|
268 |
+
#ex.dataset.headers = [""]
|
269 |
negative.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|
270 |
text.submit(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|
271 |
btn.click(infer, inputs=[text, negative, guidance_scale], outputs=[gallery], postprocess=False)
|