Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -117,7 +117,7 @@ license_str_en_orig = """
|
|
117 |
"""
|
118 |
|
119 |
@spaces.GPU
|
120 |
-
def
|
121 |
prompt,
|
122 |
style,
|
123 |
lang='ja',
|
@@ -132,7 +132,6 @@ def infer(
|
|
132 |
progress=gr.Progress(track_tqdm=True),
|
133 |
):
|
134 |
now = datetime.datetime.now()
|
135 |
-
print("button clickeds : ", now, prompt, style, lang)
|
136 |
style_to_prompt = {
|
137 |
"sensei art / 先生アート" : "先生アートsensei artイラスト",
|
138 |
"digital illustration / デジタルイラスト" : "デジタルイラスト、digital illustration",
|
@@ -163,8 +162,6 @@ def infer(
|
|
163 |
prompt = style_to_prompt[style] + ", " + prompt
|
164 |
# prompt = prompt + " " + style_to_prompt[style]
|
165 |
negative_prompt = negative_prompt + ", " + style2negative_prompt[style]
|
166 |
-
print("prompt : ", prompt)
|
167 |
-
print("ne_prompt : ", negative_prompt)
|
168 |
|
169 |
width, height = 768, 768
|
170 |
if ar == '16:9':
|
@@ -241,6 +238,24 @@ def infer(
|
|
241 |
image_w_logo.paste(likes_logo_img, (0, image.height))
|
242 |
yield image_w_logo, license_str, detected_public_fictional_characters_info, seed
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
# Seafoam theme based on
|
246 |
# https://huggingface.co/spaces/gradio/seafoam
|
|
|
117 |
"""
|
118 |
|
119 |
@spaces.GPU
|
120 |
+
def infer_impl(
|
121 |
prompt,
|
122 |
style,
|
123 |
lang='ja',
|
|
|
132 |
progress=gr.Progress(track_tqdm=True),
|
133 |
):
|
134 |
now = datetime.datetime.now()
|
|
|
135 |
style_to_prompt = {
|
136 |
"sensei art / 先生アート" : "先生アートsensei artイラスト",
|
137 |
"digital illustration / デジタルイラスト" : "デジタルイラスト、digital illustration",
|
|
|
162 |
prompt = style_to_prompt[style] + ", " + prompt
|
163 |
# prompt = prompt + " " + style_to_prompt[style]
|
164 |
negative_prompt = negative_prompt + ", " + style2negative_prompt[style]
|
|
|
|
|
165 |
|
166 |
width, height = 768, 768
|
167 |
if ar == '16:9':
|
|
|
238 |
image_w_logo.paste(likes_logo_img, (0, image.height))
|
239 |
yield image_w_logo, license_str, detected_public_fictional_characters_info, seed
|
240 |
|
241 |
+
def infer(
|
242 |
+
prompt,
|
243 |
+
style,
|
244 |
+
lang='ja',
|
245 |
+
negative_prompt="elan doodle",
|
246 |
+
seed=42,
|
247 |
+
randomize_seed=True,
|
248 |
+
ar="1:1",
|
249 |
+
# width=672,
|
250 |
+
# height=896,
|
251 |
+
guidance_scale=5.0,
|
252 |
+
num_inference_steps=40,
|
253 |
+
progress=gr.Progress(track_tqdm=True),
|
254 |
+
):
|
255 |
+
if any([a in prompt for a in bad_words]):
|
256 |
+
return None, "## <span style='color:orangered'>ERROR: Invalid prompt / 不適切なプロンプト </span>", None, seed
|
257 |
+
return infer_impl(prompt, style, lang, negative_prompt, seed, randomize_seed, ar, guidance_scale, num_inference_steps, progress)
|
258 |
+
|
259 |
|
260 |
# Seafoam theme based on
|
261 |
# https://huggingface.co/spaces/gradio/seafoam
|