tori29umai commited on
Commit
2c9c0b4
1 Parent(s): 4469e93
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -37,6 +37,7 @@ class Img2Img:
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()
@@ -53,16 +54,13 @@ class Img2Img:
53
  load_tagger_model(self.tagger_dir)
54
  load_lora_model(self.lora_dir)
55
 
56
-
57
-
58
-
59
-
60
- def process_prompt_analysis(self, input_image_path):
61
- if self.tagger_model is None:
62
- self.tagger_model = modelLoad(self.tagger_dir)
63
- tags = analysis(input_image_path, self.tagger_dir, self.tagger_model)
64
  tags_list = tags
65
- if self.post_filter:
66
  tags_list = remove_color(tags)
67
  return tags_list
68
 
@@ -90,7 +88,7 @@ class Img2Img:
90
 
91
  prompt_analysis_button.click(
92
  self.process_prompt_analysis,
93
- inputs=[self.input_image_path],
94
  outputs=self.prompt
95
  )
96
 
 
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()
 
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:
64
  tags_list = remove_color(tags)
65
  return tags_list
66
 
 
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