Spaces:
Sleeping
Sleeping
Surface engraving API errors instead of silent fallback
Browse files
app.py
CHANGED
|
@@ -55,8 +55,9 @@ def stylize(img, style, hex_color):
|
|
| 55 |
model="timbrooks/instruct-pix2pix",
|
| 56 |
)
|
| 57 |
return result.convert("RGB")
|
| 58 |
-
except Exception:
|
| 59 |
-
|
|
|
|
| 60 |
# fallback: high-contrast sharpened grayscale
|
| 61 |
return ImageOps.autocontrast(ImageEnhance.Sharpness(img.convert("L")).enhance(3.0), cutoff=2).convert("RGB")
|
| 62 |
|
|
@@ -288,6 +289,7 @@ CSS = """
|
|
| 288 |
body, .gradio-container, .main { background: #F7F0E6 !important; }
|
| 289 |
footer { display: none !important; }
|
| 290 |
.gradio-container { max-width: 1080px !important; margin: 0 auto !important; padding: 0 !important; }
|
|
|
|
| 291 |
|
| 292 |
/* βββ Blocks / panels βββ */
|
| 293 |
.block, .form {
|
|
@@ -321,7 +323,6 @@ footer { display: none !important; }
|
|
| 321 |
border: 2px dashed #C4B49A !important;
|
| 322 |
border-radius: 12px !important;
|
| 323 |
width: 100% !important;
|
| 324 |
-
height: 100% !important;
|
| 325 |
box-sizing: border-box !important;
|
| 326 |
position: relative !important;
|
| 327 |
left: auto !important;
|
|
@@ -578,7 +579,7 @@ SECTION_DIVIDER = """
|
|
| 578 |
"""
|
| 579 |
|
| 580 |
CONTROLS_HEADER = """
|
| 581 |
-
<div style="font-family:'Space Mono',monospace;font-size:.6rem;letter-spacing:.18em;text-transform:uppercase;color:#3D2E1E;margin-bottom:20px;
|
| 582 |
ββ studio controls ββ
|
| 583 |
</div>
|
| 584 |
"""
|
|
@@ -598,7 +599,7 @@ with gr.Blocks(title="stamp maker β¦") as demo:
|
|
| 598 |
with gr.Row(equal_height=False):
|
| 599 |
|
| 600 |
# ββ Controls ββ
|
| 601 |
-
with gr.Column(scale=5, min_width=300):
|
| 602 |
gr.HTML(CONTROLS_HEADER)
|
| 603 |
img_in = gr.Image(
|
| 604 |
label="photo",
|
|
|
|
| 55 |
model="timbrooks/instruct-pix2pix",
|
| 56 |
)
|
| 57 |
return result.convert("RGB")
|
| 58 |
+
except Exception as e:
|
| 59 |
+
print(f"[engraving] HF API error: {e}")
|
| 60 |
+
raise gr.Error(f"Engraving failed: {e}")
|
| 61 |
# fallback: high-contrast sharpened grayscale
|
| 62 |
return ImageOps.autocontrast(ImageEnhance.Sharpness(img.convert("L")).enhance(3.0), cutoff=2).convert("RGB")
|
| 63 |
|
|
|
|
| 289 |
body, .gradio-container, .main { background: #F7F0E6 !important; }
|
| 290 |
footer { display: none !important; }
|
| 291 |
.gradio-container { max-width: 1080px !important; margin: 0 auto !important; padding: 0 !important; }
|
| 292 |
+
#controls-col { padding-top: 36px !important; overflow: visible !important; }
|
| 293 |
|
| 294 |
/* βββ Blocks / panels βββ */
|
| 295 |
.block, .form {
|
|
|
|
| 323 |
border: 2px dashed #C4B49A !important;
|
| 324 |
border-radius: 12px !important;
|
| 325 |
width: 100% !important;
|
|
|
|
| 326 |
box-sizing: border-box !important;
|
| 327 |
position: relative !important;
|
| 328 |
left: auto !important;
|
|
|
|
| 579 |
"""
|
| 580 |
|
| 581 |
CONTROLS_HEADER = """
|
| 582 |
+
<div style="font-family:'Space Mono',monospace;font-size:.6rem;letter-spacing:.18em;text-transform:uppercase;color:#3D2E1E;margin-bottom:20px;">
|
| 583 |
ββ studio controls ββ
|
| 584 |
</div>
|
| 585 |
"""
|
|
|
|
| 599 |
with gr.Row(equal_height=False):
|
| 600 |
|
| 601 |
# ββ Controls ββ
|
| 602 |
+
with gr.Column(scale=5, min_width=300, elem_id="controls-col"):
|
| 603 |
gr.HTML(CONTROLS_HEADER)
|
| 604 |
img_in = gr.Image(
|
| 605 |
label="photo",
|