Spaces:
Running
on
Zero
Running
on
Zero
tori29umai
commited on
Commit
•
6dbbd62
1
Parent(s):
cadf53e
app.py
Browse files
app.py
CHANGED
@@ -34,9 +34,10 @@ class Img2Img:
|
|
34 |
self.setup_paths()
|
35 |
self.setup_models()
|
36 |
self.demo = self.layout()
|
|
|
|
|
37 |
self.input_image_path = None
|
38 |
|
39 |
-
|
40 |
def setup_paths(self):
|
41 |
self.path = os.getcwd()
|
42 |
self.cn_dir = f"{self.path}/controlnet"
|
@@ -51,12 +52,15 @@ class Img2Img:
|
|
51 |
load_cn_config(self.cn_dir)
|
52 |
load_tagger_model(self.tagger_dir)
|
53 |
load_lora_model(self.lora_dir)
|
54 |
-
self.tagger_model = modelLoad(self.tagger_dir)
|
55 |
|
56 |
-
|
57 |
-
def process_prompt_analysis(input_image_path
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
return tags_list
|
61 |
|
62 |
|
@@ -83,7 +87,7 @@ class Img2Img:
|
|
83 |
|
84 |
prompt_analysis_button.click(
|
85 |
self.process_prompt_analysis,
|
86 |
-
inputs=[self.input_image_path
|
87 |
outputs=self.prompt
|
88 |
)
|
89 |
|
|
|
34 |
self.setup_paths()
|
35 |
self.setup_models()
|
36 |
self.demo = self.layout()
|
37 |
+
self.post_filter = True
|
38 |
+
self.tagger_model = None
|
39 |
self.input_image_path = None
|
40 |
|
|
|
41 |
def setup_paths(self):
|
42 |
self.path = os.getcwd()
|
43 |
self.cn_dir = f"{self.path}/controlnet"
|
|
|
52 |
load_cn_config(self.cn_dir)
|
53 |
load_tagger_model(self.tagger_dir)
|
54 |
load_lora_model(self.lora_dir)
|
|
|
55 |
|
56 |
+
|
57 |
+
def process_prompt_analysis(self, input_image_path):
|
58 |
+
if self.tagger_model is None:
|
59 |
+
self.tagger_model = modelLoad(self.tagger_dir)
|
60 |
+
tags = analysis(input_image_path, self.tagger_dir, self.tagger_model)
|
61 |
+
tags_list = tags
|
62 |
+
if self.post_filter:
|
63 |
+
tags_list = remove_color(tags)
|
64 |
return tags_list
|
65 |
|
66 |
|
|
|
87 |
|
88 |
prompt_analysis_button.click(
|
89 |
self.process_prompt_analysis,
|
90 |
+
inputs=[self.input_image_path],
|
91 |
outputs=self.prompt
|
92 |
)
|
93 |
|