Spaces:
Running
on
Zero
Running
on
Zero
tori29umai
commited on
Commit
•
2a1ec11
1
Parent(s):
0f7b386
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,7 @@ def load_model(lora_model):
|
|
44 |
pipe.enable_model_cpu_offload()
|
45 |
|
46 |
# LoRAモデルの設定
|
47 |
-
if lora_model == "
|
48 |
pipe.load_lora_weights(lora_dir, weight_name="tori29umai_line.safetensors", adapter_name="tori29umai_line")
|
49 |
pipe.set_adapters(["tori29umai_line"], adapter_weights=[1.0])
|
50 |
elif lora_model == "プレーン":
|
@@ -66,9 +66,16 @@ def predict(lora_model, input_image_path, prompt, negative_prompt, controlnet_sc
|
|
66 |
resize_base_image = resize_image_aspect_ratio(base_image)
|
67 |
generator = torch.manual_seed(0)
|
68 |
last_time = time.time()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
prompt = "masterpiece, best quality, monochrome, greyscale, lineart, white background, " + prompt
|
72 |
|
73 |
execute_tags = ["realistic", "nose", "asian"]
|
74 |
prompt = execute_prompt(execute_tags, prompt)
|
@@ -104,7 +111,7 @@ class Img2Img:
|
|
104 |
self.tagger_model = modelLoad(tagger_dir)
|
105 |
tags = analysis(input_image_path, tagger_dir, self.tagger_model)
|
106 |
prompt = remove_color(tags)
|
107 |
-
execute_tags = ["realistic", "nose", "asian"]
|
108 |
prompt = execute_prompt(execute_tags, prompt)
|
109 |
prompt = remove_duplicates(prompt)
|
110 |
return prompt
|
@@ -121,7 +128,7 @@ class Img2Img:
|
|
121 |
with gr.Row():
|
122 |
with gr.Column():
|
123 |
# LoRAモデル選択ドロップダウン
|
124 |
-
self.lora_model = gr.Dropdown(label="Image Style", choices=["
|
125 |
self.input_image_path = gr.Image(label="Input image", type='filepath')
|
126 |
self.bg_removed_image_path = gr.Image(label="Background Removed Image", type='filepath')
|
127 |
|
|
|
44 |
pipe.enable_model_cpu_offload()
|
45 |
|
46 |
# LoRAモデルの設定
|
47 |
+
if lora_model == "少女漫画風":
|
48 |
pipe.load_lora_weights(lora_dir, weight_name="tori29umai_line.safetensors", adapter_name="tori29umai_line")
|
49 |
pipe.set_adapters(["tori29umai_line"], adapter_weights=[1.0])
|
50 |
elif lora_model == "プレーン":
|
|
|
66 |
resize_base_image = resize_image_aspect_ratio(base_image)
|
67 |
generator = torch.manual_seed(0)
|
68 |
last_time = time.time()
|
69 |
+
|
70 |
+
# LoRAモデルの設定
|
71 |
+
if lora_model == "少女漫画風":
|
72 |
+
prompt = "masterpiece, best quality, monochrome, greyscale, lineart, white background, bright pupils, " + prompt
|
73 |
+
elif lora_model == "プレーン":
|
74 |
+
# プロンプト生成
|
75 |
+
prompt = "masterpiece, best quality, monochrome, greyscale, lineart, white background, " + prompt
|
76 |
+
|
77 |
|
78 |
+
|
|
|
79 |
|
80 |
execute_tags = ["realistic", "nose", "asian"]
|
81 |
prompt = execute_prompt(execute_tags, prompt)
|
|
|
111 |
self.tagger_model = modelLoad(tagger_dir)
|
112 |
tags = analysis(input_image_path, tagger_dir, self.tagger_model)
|
113 |
prompt = remove_color(tags)
|
114 |
+
execute_tags = ["realistic", "nose", "asian", "smile"]
|
115 |
prompt = execute_prompt(execute_tags, prompt)
|
116 |
prompt = remove_duplicates(prompt)
|
117 |
return prompt
|
|
|
128 |
with gr.Row():
|
129 |
with gr.Column():
|
130 |
# LoRAモデル選択ドロップダウン
|
131 |
+
self.lora_model = gr.Dropdown(label="Image Style", choices=["少女漫画風", "プレーン"], value="少女漫画風")
|
132 |
self.input_image_path = gr.Image(label="Input image", type='filepath')
|
133 |
self.bg_removed_image_path = gr.Image(label="Background Removed Image", type='filepath')
|
134 |
|