Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,7 +95,7 @@ def generate_turnaround(
|
|
| 95 |
seed=42,
|
| 96 |
randomize_seed=False,
|
| 97 |
true_guidance_scale=1.0,
|
| 98 |
-
num_inference_steps=
|
| 99 |
progress=gr.Progress(track_tqdm=True),
|
| 100 |
):
|
| 101 |
"""
|
|
@@ -143,13 +143,19 @@ def generate_turnaround(
|
|
| 143 |
css = """
|
| 144 |
#col-container {
|
| 145 |
margin: 0 auto;
|
| 146 |
-
max-width:
|
| 147 |
}
|
| 148 |
.view-label {
|
| 149 |
text-align: center;
|
| 150 |
font-weight: bold;
|
| 151 |
margin-top: 10px;
|
| 152 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
"""
|
| 154 |
|
| 155 |
with gr.Blocks(css=css) as demo:
|
|
@@ -158,13 +164,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 158 |
|
| 159 |
with gr.Column(elem_id="col-container"):
|
| 160 |
with gr.Row():
|
| 161 |
-
input_images = gr.
|
| 162 |
label="入力画像(キャラクター画像をアップロード)",
|
| 163 |
show_label=True,
|
| 164 |
type="pil",
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
object_fit="contain"
|
| 168 |
)
|
| 169 |
|
| 170 |
run_button = gr.Button("🎨 4視点立ち絵を生成", variant="primary", size="lg")
|
|
@@ -173,15 +178,15 @@ with gr.Blocks(css=css) as demo:
|
|
| 173 |
|
| 174 |
with gr.Row():
|
| 175 |
with gr.Column():
|
| 176 |
-
result_front = gr.Image(label="正面", type="pil", height=
|
| 177 |
with gr.Column():
|
| 178 |
-
result_back = gr.Image(label="背面", type="pil", height=
|
| 179 |
|
| 180 |
with gr.Row():
|
| 181 |
with gr.Column():
|
| 182 |
-
result_left = gr.Image(label="左側面", type="pil", height=
|
| 183 |
with gr.Column():
|
| 184 |
-
result_right = gr.Image(label="右側面", type="pil", height=
|
| 185 |
|
| 186 |
with gr.Accordion("⚙️ 詳細設定", open=False):
|
| 187 |
seed = gr.Slider(
|
|
@@ -208,7 +213,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 208 |
minimum=1,
|
| 209 |
maximum=40,
|
| 210 |
step=1,
|
| 211 |
-
value=
|
| 212 |
)
|
| 213 |
|
| 214 |
run_button.click(
|
|
|
|
| 95 |
seed=42,
|
| 96 |
randomize_seed=False,
|
| 97 |
true_guidance_scale=1.0,
|
| 98 |
+
num_inference_steps=8,
|
| 99 |
progress=gr.Progress(track_tqdm=True),
|
| 100 |
):
|
| 101 |
"""
|
|
|
|
| 143 |
css = """
|
| 144 |
#col-container {
|
| 145 |
margin: 0 auto;
|
| 146 |
+
max-width: 1400px;
|
| 147 |
}
|
| 148 |
.view-label {
|
| 149 |
text-align: center;
|
| 150 |
font-weight: bold;
|
| 151 |
margin-top: 10px;
|
| 152 |
}
|
| 153 |
+
/* 画像のアスペクト比を保持 */
|
| 154 |
+
.image-container img {
|
| 155 |
+
object-fit: contain !important;
|
| 156 |
+
max-width: 100%;
|
| 157 |
+
max-height: 100%;
|
| 158 |
+
}
|
| 159 |
"""
|
| 160 |
|
| 161 |
with gr.Blocks(css=css) as demo:
|
|
|
|
| 164 |
|
| 165 |
with gr.Column(elem_id="col-container"):
|
| 166 |
with gr.Row():
|
| 167 |
+
input_images = gr.Image(
|
| 168 |
label="入力画像(キャラクター画像をアップロード)",
|
| 169 |
show_label=True,
|
| 170 |
type="pil",
|
| 171 |
+
height=500,
|
| 172 |
+
sources=["upload", "clipboard"]
|
|
|
|
| 173 |
)
|
| 174 |
|
| 175 |
run_button = gr.Button("🎨 4視点立ち絵を生成", variant="primary", size="lg")
|
|
|
|
| 178 |
|
| 179 |
with gr.Row():
|
| 180 |
with gr.Column():
|
| 181 |
+
result_front = gr.Image(label="正面", type="pil", height=500, show_download_button=True, container=True, image_mode="RGB")
|
| 182 |
with gr.Column():
|
| 183 |
+
result_back = gr.Image(label="背面", type="pil", height=500, show_download_button=True, container=True, image_mode="RGB")
|
| 184 |
|
| 185 |
with gr.Row():
|
| 186 |
with gr.Column():
|
| 187 |
+
result_left = gr.Image(label="左側面", type="pil", height=500, show_download_button=True, container=True, image_mode="RGB")
|
| 188 |
with gr.Column():
|
| 189 |
+
result_right = gr.Image(label="右側面", type="pil", height=500, show_download_button=True, container=True, image_mode="RGB")
|
| 190 |
|
| 191 |
with gr.Accordion("⚙️ 詳細設定", open=False):
|
| 192 |
seed = gr.Slider(
|
|
|
|
| 213 |
minimum=1,
|
| 214 |
maximum=40,
|
| 215 |
step=1,
|
| 216 |
+
value=8,
|
| 217 |
)
|
| 218 |
|
| 219 |
run_button.click(
|