tori29umai commited on
Commit
97219d6
1 Parent(s): beb8e73
Files changed (1) hide show
  1. app.py +35 -37
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import spaces
2
  import gradio as gr
3
- from gradio_imageslider import ImageSlider
4
  import torch
5
 
6
  torch.jit.script = lambda f: f
@@ -127,43 +126,42 @@ class Img2Img:
127
  """
128
  def layout(self,css):
129
  with gr.Blocks(css=css) as demo:
130
- with gr.Row() as block:
131
- with gr.Column():
132
- # 画像アップロード用の行
133
- with gr.Row():
134
- with gr.Column():
135
- self.input_image_path = gr.Image(label="入力画像", type='filepath')
136
-
137
- # プロンプト入力用の行
138
- with gr.Row():
139
- prompt_analysis = PromptAnalysis(tagger_dir)
140
- [prompt, nega] = prompt_analysis.layout(self.input_image_path)
141
- # 画像の詳細設定用のスライダー行
142
- with gr.Row():
143
- controlnet_conditioning_scale = gr.Slider(minimum=0.5, maximum=1.25, value=1.0, step=0.01, interactive=True, label="線画忠実度")
144
 
145
- # 画像生成ボタンの行
146
- with gr.Row():
147
- generate_button = gr.Button("生成", interactive=False)
148
-
149
- with gr.Column():
150
- output_image = gr.Image(type="pil", label="Output Image")
151
-
152
- # インプットとアウトプットの設定
153
- inputs = [
154
- self.input_image_path,
155
- prompt,
156
- nega,
157
- controlnet_conditioning_scale,
158
- ]
159
- outputs = [output_image]
160
-
161
- # ボタンのクリックイベントを設定
162
- generate_button.click(
163
- fn=self.predict,
164
- inputs=[self.input_image_path, prompt, nega, controlnet_conditioning_scale],
165
- outputs=[output_image]
166
- )
 
 
 
 
 
 
 
 
167
 
168
  # デモの設定と起動
169
  demo.queue(api_open=True)
 
1
  import spaces
2
  import gradio as gr
 
3
  import torch
4
 
5
  torch.jit.script = lambda f: f
 
126
  """
127
  def layout(self,css):
128
  with gr.Blocks(css=css) as demo:
129
+ with gr.Column():
130
+ # 画像アップロード用の行
131
+ with gr.Row():
132
+ with gr.Column():
133
+ self.input_image_path = gr.Image(label="入力画像", type='filepath')
 
 
 
 
 
 
 
 
 
134
 
135
+ # プロンプト入力用の行
136
+ with gr.Row():
137
+ prompt_analysis = PromptAnalysis(tagger_dir)
138
+ [prompt, nega] = prompt_analysis.layout(self.input_image_path)
139
+ # 画像の詳細設定用のスライダー行
140
+ with gr.Row():
141
+ controlnet_conditioning_scale = gr.Slider(minimum=0.5, maximum=1.25, value=1.0, step=0.01, interactive=True, label="線画忠実度")
142
+
143
+ # 画像生成ボタンの行
144
+ with gr.Row():
145
+ generate_button = gr.Button("生成", interactive=False)
146
+
147
+ with gr.Column():
148
+ output_image = gr.Image(type="pil", label="Output Image")
149
+
150
+ # インプットとアウトプットの設定
151
+ inputs = [
152
+ self.input_image_path,
153
+ prompt,
154
+ nega,
155
+ controlnet_conditioning_scale,
156
+ ]
157
+ outputs = [output_image]
158
+
159
+ # ボタンのクリックイベントを設定
160
+ generate_button.click(
161
+ fn=self.predict,
162
+ inputs=[self.input_image_path, prompt, nega, controlnet_conditioning_scale],
163
+ outputs=[output_image]
164
+ )
165
 
166
  # デモの設定と起動
167
  demo.queue(api_open=True)