tori29umai commited on
Commit
f091221
1 Parent(s): d0a0381
Files changed (1) hide show
  1. app.py +20 -17
app.py CHANGED
@@ -54,21 +54,8 @@ class Img2Img:
54
  load_lora_model(self.lora_dir)
55
 
56
 
57
- def prompt_layout(self):
58
- with gr.Column():
59
- with gr.Row():
60
- self.prompt = gr.Textbox(label="prompt", lines=3)
61
- with gr.Row():
62
- self.negative_prompt = gr.Textbox(label="negative_prompt", lines=3, value="lowres, error, extra digit, fewer digits, cropped, worst quality,low quality, normal quality, jpeg artifacts, blurry")
63
- with gr.Row():
64
- self.prompt_analysis_button = gr.Button("prompt解析")
65
 
66
- self.prompt_analysis_button.click(
67
- self.process_prompt_analysis,
68
- inputs=[self.input_image_path],
69
- outputs=self.prompt
70
- )
71
- return [self.prompt, self.negative_prompt]
72
 
73
  def process_prompt_analysis(self, input_image_path):
74
  if self.tagger_model is None:
@@ -92,12 +79,28 @@ class Img2Img:
92
  with gr.Row():
93
  with gr.Column():
94
  self.input_image_path = gr.Image(label="input_image", type='filepath')
95
- self.prompt, self.negative_prompt = self.prompt_layout()
96
- self.controlnet_scale = gr.Slider(minimum=0.5, maximum=1.25, value=1.0, step=0.01, label="線画忠実度")
97
- generate_button = gr.Button("生成")
 
 
 
 
 
 
 
 
98
  with gr.Column():
99
  self.output_image = gr.Image(type="pil", label="出力画像")
100
 
 
 
 
 
 
 
 
 
101
  generate_button.click(
102
  fn=self.predict,
103
  inputs=[self.input_image_path, self.prompt, self.negative_prompt, self.controlnet_scale],
 
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:
 
79
  with gr.Row():
80
  with gr.Column():
81
  self.input_image_path = gr.Image(label="input_image", type='filepath')
82
+ with gr.Column():
83
+ with gr.Row():
84
+ self.prompt = gr.Textbox(label="prompt", lines=3)
85
+ with gr.Row():
86
+ self.negative_prompt = gr.Textbox(label="negative_prompt", lines=3, value="lowres, error, extra digit, fewer digits, cropped, worst quality,low quality, normal quality, jpeg artifacts, blurry")
87
+ with gr.Row():
88
+ prompt_analysis_button = gr.Button("prompt解析")
89
+ with gr.Row():
90
+ self.controlnet_scale = gr.Slider(minimum=0.5, maximum=1.25, value=1.0, step=0.01, label="線画忠実度")
91
+ with gr.Row():
92
+ generate_button = gr.Button("生成")
93
  with gr.Column():
94
  self.output_image = gr.Image(type="pil", label="出力画像")
95
 
96
+
97
+ prompt_analysis_button.click(
98
+ self.process_prompt_analysis,
99
+ inputs=[self.input_image_path],
100
+ outputs=self.prompt
101
+ )
102
+
103
+
104
  generate_button.click(
105
  fn=self.predict,
106
  inputs=[self.input_image_path, self.prompt, self.negative_prompt, self.controlnet_scale],