tori29umai commited on
Commit
4948a0e
1 Parent(s): 2c9c0b4
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -35,9 +35,8 @@ class Img2Img:
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
- self.tagger_model = None
41
 
42
  def setup_paths(self):
43
  self.path = os.getcwd()
@@ -53,11 +52,10 @@ class Img2Img:
53
  load_cn_config(self.cn_dir)
54
  load_tagger_model(self.tagger_dir)
55
  load_lora_model(self.lora_dir)
 
56
 
57
  @staticmethod
58
- def process_prompt_analysis(input_image_path,tagger_model,tagger_dir,post_filter):
59
- if tagger_model is None:
60
- tagger_model = modelLoad(tagger_dir)
61
  tags = analysis(input_image_path, tagger_dir, tagger_model)
62
  tags_list = tags
63
  if post_filter:
@@ -88,7 +86,7 @@ class Img2Img:
88
 
89
  prompt_analysis_button.click(
90
  self.process_prompt_analysis,
91
- inputs=[self.input_image_path,self.tagger_model,self.tagger_dir,self.post_filter],
92
  outputs=self.prompt
93
  )
94
 
 
35
  self.setup_models()
36
  self.demo = self.layout()
37
  self.post_filter = True
 
38
  self.input_image_path = None
39
+
40
 
41
  def setup_paths(self):
42
  self.path = os.getcwd()
 
52
  load_cn_config(self.cn_dir)
53
  load_tagger_model(self.tagger_dir)
54
  load_lora_model(self.lora_dir)
55
+ self.tagger_model = modelLoad(self.tagger_dir)
56
 
57
  @staticmethod
58
+ def process_prompt_analysis(input_image_path,tagger_model,tagger_dir,post_filter):
 
 
59
  tags = analysis(input_image_path, tagger_dir, tagger_model)
60
  tags_list = tags
61
  if post_filter:
 
86
 
87
  prompt_analysis_button.click(
88
  self.process_prompt_analysis,
89
+ inputs=[self.input_image_path, self.tagger_model, self.tagger_dir, self.post_filter],
90
  outputs=self.prompt
91
  )
92