Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -6,14 +6,14 @@ import numpy as np
|
|
6 |
import spaces
|
7 |
import torch
|
8 |
|
9 |
-
from
|
10 |
|
11 |
|
12 |
-
DESCRIPTION = """# 🐟
|
13 |
🤗 [モデル一覧](https://huggingface.co/SakanaAI) | 📚 [技術レポート](https://arxiv.org/abs/2403.13187) | 📝 [ブログ](https://sakana.ai/evosdxl-jp/) | 🐦 [Twitter](https://twitter.com/SakanaAILabs)
|
14 |
|
15 |
-
[
|
16 |
-
|
17 |
"""
|
18 |
if not torch.cuda.is_available():
|
19 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
@@ -46,7 +46,7 @@ if SAFETY_CHECKER:
|
|
46 |
return images, has_nsfw_concepts
|
47 |
|
48 |
|
49 |
-
pipe =
|
50 |
|
51 |
|
52 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
@@ -68,11 +68,12 @@ def generate(
|
|
68 |
generator = torch.Generator().manual_seed(seed)
|
69 |
|
70 |
images = pipe(
|
71 |
-
prompt=prompt + "
|
|
|
72 |
width=1024,
|
73 |
height=1024,
|
74 |
guidance_scale=8.0,
|
75 |
-
num_inference_steps=
|
76 |
generator=generator,
|
77 |
num_images_per_prompt=NUM_IMAGES_PER_PROMPT,
|
78 |
output_type="pil",
|
@@ -87,12 +88,9 @@ def generate(
|
|
87 |
|
88 |
|
89 |
examples = [
|
90 |
-
["
|
91 |
-
["熊が本を読んでいる。"],
|
92 |
-
["猫が畳の上で寝ている。"],
|
93 |
-
["象が刀を持っている。"],
|
94 |
-
["男性と女性が戦っている。"],
|
95 |
["富士山、桜の木、川と人々の風景。"],
|
|
|
96 |
]
|
97 |
|
98 |
css = """
|
@@ -105,7 +103,7 @@ with gr.Blocks(css=css) as demo:
|
|
105 |
with gr.Row():
|
106 |
prompt = gr.Textbox(placeholder="日本語でプロンプトを入力してください。", show_label=False, scale=8)
|
107 |
submit = gr.Button(scale=0)
|
108 |
-
result = gr.Image(label="
|
109 |
with gr.Accordion("詳細設定", open=False):
|
110 |
seed = gr.Slider(label="シード値", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
111 |
randomize_seed = gr.Checkbox(label="ランダムにシード値を決定", value=True)
|
@@ -129,4 +127,4 @@ with gr.Blocks(css=css) as demo:
|
|
129 |
Sakana AIは、本モデルの使用によって生じた直接的または間接的な損失に対して、結果に関わらず、一切の責任を負いません。
|
130 |
利用者は、本モデルの使用に伴うリスクを十分に理解し、自身の判断で使用することが必要です。""")
|
131 |
|
132 |
-
demo.queue().launch()
|
|
|
6 |
import spaces
|
7 |
import torch
|
8 |
|
9 |
+
from evo_ukiyoe_v1 import load_evo_ukiyoe
|
10 |
|
11 |
|
12 |
+
DESCRIPTION = """# 🐟 Evo-Ukiyoe
|
13 |
🤗 [モデル一覧](https://huggingface.co/SakanaAI) | 📚 [技術レポート](https://arxiv.org/abs/2403.13187) | 📝 [ブログ](https://sakana.ai/evosdxl-jp/) | 🐦 [Twitter](https://twitter.com/SakanaAILabs)
|
14 |
|
15 |
+
[Evo-Ukiyoe](https://huggingface.co/SakanaAI/Evo-Ukiyoe-v1)は[Sakana AI](https://sakana.ai/)が教育目的で開発した浮世絵に特化した画像生成モデルです。
|
16 |
+
入力した日本語プロンプトに沿った浮世絵風の画像を生成することができます。より詳しくは、上記のブログをご参照ください。
|
17 |
"""
|
18 |
if not torch.cuda.is_available():
|
19 |
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
|
|
|
46 |
return images, has_nsfw_concepts
|
47 |
|
48 |
|
49 |
+
pipe = load_evo_ukiyoe("cpu").to(device)
|
50 |
|
51 |
|
52 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
|
68 |
generator = torch.Generator().manual_seed(seed)
|
69 |
|
70 |
images = pipe(
|
71 |
+
prompt=prompt + "最高品質の輻の浮世絵。",
|
72 |
+
negative_prompt="",
|
73 |
width=1024,
|
74 |
height=1024,
|
75 |
guidance_scale=8.0,
|
76 |
+
num_inference_steps=50,
|
77 |
generator=generator,
|
78 |
num_images_per_prompt=NUM_IMAGES_PER_PROMPT,
|
79 |
output_type="pil",
|
|
|
88 |
|
89 |
|
90 |
examples = [
|
91 |
+
["鶴が庭に立っている。雪が降っている。"],
|
|
|
|
|
|
|
|
|
92 |
["富士山、桜の木、川と人々の風景。"],
|
93 |
+
["熊が本を読んでいる。"],
|
94 |
]
|
95 |
|
96 |
css = """
|
|
|
103 |
with gr.Row():
|
104 |
prompt = gr.Textbox(placeholder="日本語でプロンプトを入力してください。", show_label=False, scale=8)
|
105 |
submit = gr.Button(scale=0)
|
106 |
+
result = gr.Image(label="Evo-Ukiyoeからの生成結果", type="pil", show_label=False)
|
107 |
with gr.Accordion("詳細設定", open=False):
|
108 |
seed = gr.Slider(label="シード値", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
109 |
randomize_seed = gr.Checkbox(label="ランダムにシード値を決定", value=True)
|
|
|
127 |
Sakana AIは、本モデルの使用によって生じた直接的または間接的な損失に対して、結果に関わらず、一切の責任を負いません。
|
128 |
利用者は、本モデルの使用に伴うリスクを十分に理解し、自身の判断で使用することが必要です。""")
|
129 |
|
130 |
+
demo.queue().launch()
|