Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,7 +66,13 @@ def find_similar_recipes_list(query_text):
|
|
| 66 |
for idx in top_indices:
|
| 67 |
row = df_recipes.iloc[idx]
|
| 68 |
title = row['Title']
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
card_content = f"### 馃弳 {title}\n\n<div class='sim-scroll'>{desc}</div>"
|
| 71 |
results_list.append(card_content)
|
| 72 |
|
|
@@ -162,9 +168,7 @@ body, .gradio-container { background-color: #f0f2f5; }
|
|
| 162 |
border-left: 4px solid #1877f2 !important;
|
| 163 |
}
|
| 164 |
|
| 165 |
-
/*
|
| 166 |
-
|
| 167 |
-
/* 1. Force the container to have NO gap, so we can control it with margin */
|
| 168 |
#feed-container {
|
| 169 |
gap: 0px !important;
|
| 170 |
padding: 0px !important;
|
|
@@ -173,18 +177,14 @@ body, .gradio-container { background-color: #f0f2f5; }
|
|
| 173 |
gap: 0px !important;
|
| 174 |
}
|
| 175 |
|
| 176 |
-
/* 2. Style individual Cards */
|
| 177 |
.content-card {
|
| 178 |
background: white;
|
| 179 |
border-radius: 12px;
|
| 180 |
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
| 181 |
border: 1px solid #ddd;
|
| 182 |
padding: 20px;
|
| 183 |
-
|
| 184 |
-
/* 3. The Specific 7px Spacing */
|
| 185 |
margin-bottom: 7px !important;
|
| 186 |
margin-top: 0px !important;
|
| 187 |
-
|
| 188 |
width: 100%;
|
| 189 |
display: block;
|
| 190 |
}
|
|
@@ -257,7 +257,7 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
|
|
| 257 |
<span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
|
| 258 |
</div>
|
| 259 |
</div>
|
| 260 |
-
<div style="color: #65676b; font-weight: 600;">v3.
|
| 261 |
</div>
|
| 262 |
""")
|
| 263 |
|
|
@@ -326,21 +326,20 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
|
|
| 326 |
magic_btn.click(ui_update_pipeline, input_img, [out_text, sim1, c1_btns, c2_box, sim2, c3_box, sim3])
|
| 327 |
|
| 328 |
# === VIEW 2: FEED ===
|
| 329 |
-
# Important: Using gr.Column with elem_id to force 0-gap on the container
|
| 330 |
with gr.Column(visible=False, elem_id="feed-container") as feed_view:
|
| 331 |
-
|
| 332 |
if not df_recipes.empty:
|
| 333 |
feed_samples = df_recipes.sample(10)
|
| 334 |
for index, row in feed_samples.iterrows():
|
| 335 |
user_name = random.choice(["Grandma Rose", "Chef Mike", "Sarah J."])
|
| 336 |
emoji = random.choice(["馃", "馃", "馃嵃", "馃尞"])
|
|
|
|
|
|
|
| 337 |
|
| 338 |
-
# Creating a floating card for each post
|
| 339 |
with gr.Group(elem_classes=["content-card"]):
|
| 340 |
gr.HTML(f"""
|
| 341 |
<div style="display:flex; gap:10px; align-items:center; margin-bottom:12px;">
|
| 342 |
<div style="width:40px; height:40px; background:#e4e6eb; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:20px;">{emoji}</div>
|
| 343 |
-
<div><b>{user_name}</b><br><span style="color:gray; font-size:12px;">
|
| 344 |
</div>
|
| 345 |
""")
|
| 346 |
gr.Markdown(f"### {row['Title']}")
|
|
|
|
| 66 |
for idx in top_indices:
|
| 67 |
row = df_recipes.iloc[idx]
|
| 68 |
title = row['Title']
|
| 69 |
+
|
| 70 |
+
# FIX: Removed truncation limit (was [:800]) to show FULL text
|
| 71 |
+
desc = str(row['Raw_Output'])
|
| 72 |
+
|
| 73 |
+
# Formatting for readability: Replace newlines with HTML breaks if needed,
|
| 74 |
+
# though Markdown usually handles it well.
|
| 75 |
+
# We wrap it in the scrollable div.
|
| 76 |
card_content = f"### 馃弳 {title}\n\n<div class='sim-scroll'>{desc}</div>"
|
| 77 |
results_list.append(card_content)
|
| 78 |
|
|
|
|
| 168 |
border-left: 4px solid #1877f2 !important;
|
| 169 |
}
|
| 170 |
|
| 171 |
+
/* Feed Styling */
|
|
|
|
|
|
|
| 172 |
#feed-container {
|
| 173 |
gap: 0px !important;
|
| 174 |
padding: 0px !important;
|
|
|
|
| 177 |
gap: 0px !important;
|
| 178 |
}
|
| 179 |
|
|
|
|
| 180 |
.content-card {
|
| 181 |
background: white;
|
| 182 |
border-radius: 12px;
|
| 183 |
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
| 184 |
border: 1px solid #ddd;
|
| 185 |
padding: 20px;
|
|
|
|
|
|
|
| 186 |
margin-bottom: 7px !important;
|
| 187 |
margin-top: 0px !important;
|
|
|
|
| 188 |
width: 100%;
|
| 189 |
display: block;
|
| 190 |
}
|
|
|
|
| 257 |
<span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
|
| 258 |
</div>
|
| 259 |
</div>
|
| 260 |
+
<div style="color: #65676b; font-weight: 600;">v3.9</div>
|
| 261 |
</div>
|
| 262 |
""")
|
| 263 |
|
|
|
|
| 326 |
magic_btn.click(ui_update_pipeline, input_img, [out_text, sim1, c1_btns, c2_box, sim2, c3_box, sim3])
|
| 327 |
|
| 328 |
# === VIEW 2: FEED ===
|
|
|
|
| 329 |
with gr.Column(visible=False, elem_id="feed-container") as feed_view:
|
|
|
|
| 330 |
if not df_recipes.empty:
|
| 331 |
feed_samples = df_recipes.sample(10)
|
| 332 |
for index, row in feed_samples.iterrows():
|
| 333 |
user_name = random.choice(["Grandma Rose", "Chef Mike", "Sarah J."])
|
| 334 |
emoji = random.choice(["馃", "馃", "馃嵃", "馃尞"])
|
| 335 |
+
time_options = ["2h", "3h", "4h", "6h", "9h", "12h", "a day ago", "2 days ago"]
|
| 336 |
+
post_time = random.choice(time_options)
|
| 337 |
|
|
|
|
| 338 |
with gr.Group(elem_classes=["content-card"]):
|
| 339 |
gr.HTML(f"""
|
| 340 |
<div style="display:flex; gap:10px; align-items:center; margin-bottom:12px;">
|
| 341 |
<div style="width:40px; height:40px; background:#e4e6eb; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:20px;">{emoji}</div>
|
| 342 |
+
<div><b>{user_name}</b><br><span style="color:gray; font-size:12px;">{post_time} 路 馃實 Public</span></div>
|
| 343 |
</div>
|
| 344 |
""")
|
| 345 |
gr.Markdown(f"### {row['Title']}")
|