Spaces:
Runtime error
Runtime error
Garrett Goon
commited on
Commit
·
c8be5d9
1
Parent(s):
bb2f2c4
more css edits and check for trivial prompt
Browse files
app.py
CHANGED
@@ -60,6 +60,8 @@ def replace_concept_tokens(text: str):
|
|
60 |
return text
|
61 |
|
62 |
def inference(prompt: str, guidance_scale: int, num_inference_steps: int, seed: int):
|
|
|
|
|
63 |
if '<det-logo>' not in prompt:
|
64 |
raise ValueError('"<det-logo>" must be included in the prompt.')
|
65 |
prompt = replace_concept_tokens(prompt)
|
@@ -148,7 +150,7 @@ css = """
|
|
148 |
}
|
149 |
#gallery {
|
150 |
min-height: 22rem;
|
151 |
-
margin-bottom:
|
152 |
margin-left: auto;
|
153 |
margin-right: auto;
|
154 |
border-bottom-right-radius: .5rem !important;
|
@@ -201,9 +203,20 @@ css = """
|
|
201 |
display: none;
|
202 |
margin-bottom: 20px;
|
203 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
.footer {
|
205 |
-
margin-bottom:
|
206 |
-
margin-top:
|
207 |
text-align: center;
|
208 |
border-bottom: 1px solid #e5e5e5;
|
209 |
background: white !important;
|
@@ -234,6 +247,7 @@ css = """
|
|
234 |
align-items: center;
|
235 |
}
|
236 |
#container-license-btns{
|
|
|
237 |
display: flex;
|
238 |
flex-wrap: wrap;
|
239 |
justify-content: space-between;
|
@@ -302,16 +316,15 @@ examples = [
|
|
302 |
with block:
|
303 |
gr.HTML(
|
304 |
"""
|
305 |
-
<div style="text-align: center; max-width: 650px; margin: 0
|
306 |
<div
|
307 |
style="
|
308 |
display: inline-flex;
|
309 |
align-items: center;
|
310 |
-
|
311 |
-
font-size: 1.75rem;
|
312 |
"
|
313 |
>
|
314 |
-
<h1 style="font-weight:
|
315 |
Determined AI Textual Inversion Demo
|
316 |
</h1>
|
317 |
</div>
|
@@ -388,7 +401,7 @@ with block:
|
|
388 |
}""",
|
389 |
)
|
390 |
with gr.Group(elem_id="container-license-btns"):
|
391 |
-
license_button = gr.Button("License,
|
392 |
elem_id="license-btn")
|
393 |
license_button.click(
|
394 |
None,
|
@@ -408,10 +421,10 @@ with block:
|
|
408 |
<div class="acknowledgments">
|
409 |
<p><h4>LICENSE</h4>
|
410 |
The model is licensed with a <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" style="text-decoration: underline;" target="_blank">CreativeML Open RAIL-M</a> license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" target="_blank" style="text-decoration: underline;" target="_blank">read the license</a></p>
|
411 |
-
<p><h4>Model Changes</h4>
|
412 |
-
The model used in this Space alters the underlying <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" style="text-decoration: underline;" target="_blank">stable-diffusion-v1-4</a> model through the addition of new embedding vectors in order to capture the likeness of the <a href="https://www.determined.ai" style="text-decoration: underline;" target="_blank">Determined AI</a> logo.</p>
|
413 |
<p><h4>Biases and content acknowledgment</h4>
|
414 |
Despite how impressive being able to turn text into image is, beware to the fact that this model may output content that reinforces or exacerbates societal biases, as well as realistic faces, pornography and violence. The model was trained on the <a href="https://laion.ai/blog/laion-5b/" style="text-decoration: underline;" target="_blank">LAION-5B dataset</a>, which scraped non-curated image-text-pairs from the internet (the exception being the removal of illegal content) and is meant for research purposes. You can read more in the <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" style="text-decoration: underline;" target="_blank">model card</a></p>
|
|
|
|
|
415 |
</div>
|
416 |
"""
|
417 |
)
|
|
|
60 |
return text
|
61 |
|
62 |
def inference(prompt: str, guidance_scale: int, num_inference_steps: int, seed: int):
|
63 |
+
if not prompt:
|
64 |
+
raise ValueError("Please enter a prompt.")
|
65 |
if '<det-logo>' not in prompt:
|
66 |
raise ValueError('"<det-logo>" must be included in the prompt.')
|
67 |
prompt = replace_concept_tokens(prompt)
|
|
|
150 |
}
|
151 |
#gallery {
|
152 |
min-height: 22rem;
|
153 |
+
margin-bottom: 1rem;
|
154 |
margin-left: auto;
|
155 |
margin-right: auto;
|
156 |
border-bottom-right-radius: .5rem !important;
|
|
|
203 |
display: none;
|
204 |
margin-bottom: 20px;
|
205 |
}
|
206 |
+
#component-1 {
|
207 |
+
max-height: 3rem;
|
208 |
+
margin-bottom: 1rem;
|
209 |
+
margin-left: auto;
|
210 |
+
margin-right: auto;
|
211 |
+
border-bottom-right-radius: .5rem !important;
|
212 |
+
border-bottom-left-radius: .5rem !important;
|
213 |
+
}
|
214 |
+
#component-21 {
|
215 |
+
max-height: 2rem;
|
216 |
+
}
|
217 |
.footer {
|
218 |
+
margin-bottom: 0px;
|
219 |
+
margin-top: 0px;
|
220 |
text-align: center;
|
221 |
border-bottom: 1px solid #e5e5e5;
|
222 |
background: white !important;
|
|
|
247 |
align-items: center;
|
248 |
}
|
249 |
#container-license-btns{
|
250 |
+
margin: 1.25em 0 .25em 0;
|
251 |
display: flex;
|
252 |
flex-wrap: wrap;
|
253 |
justify-content: space-between;
|
|
|
316 |
with block:
|
317 |
gr.HTML(
|
318 |
"""
|
319 |
+
<div style="text-align: center; max-width: 650px; margin: 1.25em 0 .25em 0;">
|
320 |
<div
|
321 |
style="
|
322 |
display: inline-flex;
|
323 |
align-items: center;
|
324 |
+
font-size: 1.5rem;
|
|
|
325 |
"
|
326 |
>
|
327 |
+
<h1 style="font-weight: 600;">
|
328 |
Determined AI Textual Inversion Demo
|
329 |
</h1>
|
330 |
</div>
|
|
|
401 |
}""",
|
402 |
)
|
403 |
with gr.Group(elem_id="container-license-btns"):
|
404 |
+
license_button = gr.Button("License, biases, and model changes",
|
405 |
elem_id="license-btn")
|
406 |
license_button.click(
|
407 |
None,
|
|
|
421 |
<div class="acknowledgments">
|
422 |
<p><h4>LICENSE</h4>
|
423 |
The model is licensed with a <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" style="text-decoration: underline;" target="_blank">CreativeML Open RAIL-M</a> license. The authors claim no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in this license. The license forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please <a href="https://huggingface.co/spaces/CompVis/stable-diffusion-license" target="_blank" style="text-decoration: underline;" target="_blank">read the license</a></p>
|
|
|
|
|
424 |
<p><h4>Biases and content acknowledgment</h4>
|
425 |
Despite how impressive being able to turn text into image is, beware to the fact that this model may output content that reinforces or exacerbates societal biases, as well as realistic faces, pornography and violence. The model was trained on the <a href="https://laion.ai/blog/laion-5b/" style="text-decoration: underline;" target="_blank">LAION-5B dataset</a>, which scraped non-curated image-text-pairs from the internet (the exception being the removal of illegal content) and is meant for research purposes. You can read more in the <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" style="text-decoration: underline;" target="_blank">model card</a></p>
|
426 |
+
<p><h4>Model Changes</h4>
|
427 |
+
The model used in this Space alters the underlying <a href="https://huggingface.co/CompVis/stable-diffusion-v1-4" style="text-decoration: underline;" target="_blank">stable-diffusion-v1-4</a> model through the addition of new embedding vectors in order to capture the likeness of the <a href="https://www.determined.ai" style="text-decoration: underline;" target="_blank">Determined AI</a> logo.</p>
|
428 |
</div>
|
429 |
"""
|
430 |
)
|