Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,7 +194,7 @@ body, .gradio-container { background-color: #f0f2f5; }
|
|
| 194 |
}
|
| 195 |
.trend-box:hover { background: #f0f2f5; cursor: pointer; }
|
| 196 |
|
| 197 |
-
/*
|
| 198 |
.gap-fix {
|
| 199 |
gap: 25px !important;
|
| 200 |
}
|
|
@@ -215,7 +215,7 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
|
|
| 215 |
<span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
|
| 216 |
</div>
|
| 217 |
</div>
|
| 218 |
-
<div style="color: #65676b; font-weight: 600;">v3.
|
| 219 |
</div>
|
| 220 |
""")
|
| 221 |
|
|
@@ -238,18 +238,30 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
|
|
| 238 |
# --- CENTER CONTENT ---
|
| 239 |
with gr.Column(scale=3):
|
| 240 |
|
| 241 |
-
# === VIEW 1: AI DIGITALIZER
|
| 242 |
with gr.Group(visible=True) as digitalizer_view:
|
| 243 |
|
| 244 |
-
# SECTION 1: UPLOAD & TEXT
|
| 245 |
-
# FIX 2: Added 'gap-fix' class to ensure space > 7px (set to 25px in CSS)
|
| 246 |
with gr.Row(elem_classes=["gap-fix"]):
|
| 247 |
-
# Left: Upload
|
| 248 |
with gr.Column(scale=1):
|
| 249 |
gr.Markdown("### 1. Upload Note", elem_classes=["content-card"])
|
| 250 |
with gr.Group(elem_classes=["content-card"]):
|
| 251 |
input_img = gr.Image(type="filepath", label="Upload", height=300)
|
| 252 |
magic_btn = gr.Button("✨ Convert to Digital", variant="primary", size="lg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
# Right: Text
|
| 255 |
with gr.Column(scale=1):
|
|
@@ -257,14 +269,13 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
|
|
| 257 |
with gr.Group(elem_classes=["content-card"]):
|
| 258 |
out_text = gr.Textbox(label="Result", lines=12, interactive=False, show_label=False)
|
| 259 |
|
| 260 |
-
#
|
| 261 |
gr.HTML("<div style='height: 35px;'></div>")
|
| 262 |
|
| 263 |
# SECTION 2: SIMILAR RECIPES
|
| 264 |
gr.Markdown("### 3. Similar Recipes from Database")
|
| 265 |
with gr.Row():
|
| 266 |
with gr.Column(elem_classes=["sim-card"]):
|
| 267 |
-
# FIX 3: Default Text when no image uploaded
|
| 268 |
sim1 = gr.Markdown("Once you will upload your scanned recipe, we will share similar recipes!")
|
| 269 |
with gr.Column(elem_classes=["sim-card"]):
|
| 270 |
sim2 = gr.Markdown("")
|
|
|
|
| 194 |
}
|
| 195 |
.trend-box:hover { background: #f0f2f5; cursor: pointer; }
|
| 196 |
|
| 197 |
+
/* Gap Fix */
|
| 198 |
.gap-fix {
|
| 199 |
gap: 25px !important;
|
| 200 |
}
|
|
|
|
| 215 |
<span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
|
| 216 |
</div>
|
| 217 |
</div>
|
| 218 |
+
<div style="color: #65676b; font-weight: 600;">v3.2</div>
|
| 219 |
</div>
|
| 220 |
""")
|
| 221 |
|
|
|
|
| 238 |
# --- CENTER CONTENT ---
|
| 239 |
with gr.Column(scale=3):
|
| 240 |
|
| 241 |
+
# === VIEW 1: AI DIGITALIZER ===
|
| 242 |
with gr.Group(visible=True) as digitalizer_view:
|
| 243 |
|
| 244 |
+
# SECTION 1: UPLOAD & TEXT
|
|
|
|
| 245 |
with gr.Row(elem_classes=["gap-fix"]):
|
| 246 |
+
# Left: Upload & Examples
|
| 247 |
with gr.Column(scale=1):
|
| 248 |
gr.Markdown("### 1. Upload Note", elem_classes=["content-card"])
|
| 249 |
with gr.Group(elem_classes=["content-card"]):
|
| 250 |
input_img = gr.Image(type="filepath", label="Upload", height=300)
|
| 251 |
magic_btn = gr.Button("✨ Convert to Digital", variant="primary", size="lg")
|
| 252 |
+
|
| 253 |
+
# NEW: Examples Component
|
| 254 |
+
gr.Examples(
|
| 255 |
+
examples=[
|
| 256 |
+
["quick_tries_images/applecrisp.jpg"],
|
| 257 |
+
["quick_tries_images/meatballs recipe.jpg"],
|
| 258 |
+
["quick_tries_images/tofu.jfif"]
|
| 259 |
+
],
|
| 260 |
+
inputs=input_img,
|
| 261 |
+
label="Or try these examples:",
|
| 262 |
+
# cache_examples=False ensures fast startup and no build errors
|
| 263 |
+
cache_examples=False
|
| 264 |
+
)
|
| 265 |
|
| 266 |
# Right: Text
|
| 267 |
with gr.Column(scale=1):
|
|
|
|
| 269 |
with gr.Group(elem_classes=["content-card"]):
|
| 270 |
out_text = gr.Textbox(label="Result", lines=12, interactive=False, show_label=False)
|
| 271 |
|
| 272 |
+
# Spacer
|
| 273 |
gr.HTML("<div style='height: 35px;'></div>")
|
| 274 |
|
| 275 |
# SECTION 2: SIMILAR RECIPES
|
| 276 |
gr.Markdown("### 3. Similar Recipes from Database")
|
| 277 |
with gr.Row():
|
| 278 |
with gr.Column(elem_classes=["sim-card"]):
|
|
|
|
| 279 |
sim1 = gr.Markdown("Once you will upload your scanned recipe, we will share similar recipes!")
|
| 280 |
with gr.Column(elem_classes=["sim-card"]):
|
| 281 |
sim2 = gr.Markdown("")
|