Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -271,11 +271,33 @@ def start_session(request: gr.Request):
|
|
| 271 |
return request.session_hash
|
| 272 |
|
| 273 |
def build_demo():
|
| 274 |
-
|
| 275 |
#col-container {
|
| 276 |
margin: 0 auto;
|
| 277 |
max-width: 1560px;
|
| 278 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
"""
|
| 280 |
theme = gr.themes.Ocean()
|
| 281 |
|
|
@@ -284,22 +306,9 @@ def build_demo():
|
|
| 284 |
demo.load(start_session, outputs=[session_state])
|
| 285 |
|
| 286 |
with gr.Column(elem_id="col-container"):
|
| 287 |
-
|
| 288 |
-
"""
|
| 289 |
-
<div style="text-align: center;">
|
| 290 |
-
<a href="https://github.com/wgsxm/PartCrafter" style="display: inline-block; vertical-align: middle; margin-left: 0.5em;">
|
| 291 |
-
<img src="https://img.shields.io/badge/GitHub-Repo-blue" alt="GitHub Repo">
|
| 292 |
-
</a>
|
| 293 |
-
</div>
|
| 294 |
-
<div style="text-align: center;">
|
| 295 |
-
HF Space by :<a href="https://twitter.com/alexandernasa/" style="display: inline-block; vertical-align: middle; margin-left: 0.5em;">
|
| 296 |
-
<img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow Me" alt="GitHub Repo">
|
| 297 |
-
</a>
|
| 298 |
-
</div>
|
| 299 |
-
"""
|
| 300 |
-
)
|
| 301 |
with gr.Row():
|
| 302 |
-
with gr.Column(scale=1):
|
| 303 |
|
| 304 |
input_image = gr.Image(type="filepath", label="Input Image", height=256)
|
| 305 |
num_parts = gr.Slider(1, MAX_NUM_PARTS, value=4, step=1, label="Number of Parts")
|
|
@@ -312,7 +321,7 @@ def build_demo():
|
|
| 312 |
flash_decoder = gr.Checkbox(value=False, label="Use Flash Decoder")
|
| 313 |
remove_bg = gr.Checkbox(value=True, label="Remove Background (RMBG)")
|
| 314 |
|
| 315 |
-
run_button = gr.Button("🚀 Generate 3D Parts")
|
| 316 |
|
| 317 |
with gr.Column(scale=2):
|
| 318 |
output_model = gr.Model3D(label="Merged 3D Object", height=512, interactive=False)
|
|
|
|
| 271 |
return request.session_hash
|
| 272 |
|
| 273 |
def build_demo():
|
| 274 |
+
css = """
|
| 275 |
#col-container {
|
| 276 |
margin: 0 auto;
|
| 277 |
max-width: 1560px;
|
| 278 |
}
|
| 279 |
+
|
| 280 |
+
.generate-btn {
|
| 281 |
+
background: linear-gradient(45deg, #22c55e, #16a34a) !important;
|
| 282 |
+
border: none !important;
|
| 283 |
+
color: white !important;
|
| 284 |
+
font-weight: bold !important;
|
| 285 |
+
transition: all 0.3s ease !important;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.generate-btn:hover {
|
| 289 |
+
background: linear-gradient(45deg, #16a34a, #15803d) !important;
|
| 290 |
+
transform: translateY(-2px) !important;
|
| 291 |
+
box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3) !important;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.left-panel {
|
| 295 |
+
display: flex;
|
| 296 |
+
flex-direction: column;
|
| 297 |
+
justify-content: center;
|
| 298 |
+
height: 100%;
|
| 299 |
+
min-height: 500px;
|
| 300 |
+
}
|
| 301 |
"""
|
| 302 |
theme = gr.themes.Ocean()
|
| 303 |
|
|
|
|
| 306 |
demo.load(start_session, outputs=[session_state])
|
| 307 |
|
| 308 |
with gr.Column(elem_id="col-container"):
|
| 309 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
with gr.Row():
|
| 311 |
+
with gr.Column(scale=1, elem_classes=["left-panel"]):
|
| 312 |
|
| 313 |
input_image = gr.Image(type="filepath", label="Input Image", height=256)
|
| 314 |
num_parts = gr.Slider(1, MAX_NUM_PARTS, value=4, step=1, label="Number of Parts")
|
|
|
|
| 321 |
flash_decoder = gr.Checkbox(value=False, label="Use Flash Decoder")
|
| 322 |
remove_bg = gr.Checkbox(value=True, label="Remove Background (RMBG)")
|
| 323 |
|
| 324 |
+
run_button = gr.Button("🚀 Generate 3D Parts", variant="primary", elem_classes=["generate-btn"])
|
| 325 |
|
| 326 |
with gr.Column(scale=2):
|
| 327 |
output_model = gr.Model3D(label="Merged 3D Object", height=512, interactive=False)
|