Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -328,6 +328,10 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 328 |
<div class="contact-name">Welcome Chef</div>
|
| 329 |
</div>
|
| 330 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
nav_digital = gr.Button("โจ Digitalize Recipe", elem_classes=["nav-btn", "selected"])
|
| 332 |
nav_feed = gr.Button("๐ฐ News Feed", elem_classes=["nav-btn"])
|
| 333 |
nav_saved = gr.Button("๐ Saved Recipes", elem_classes=["nav-btn"])
|
|
@@ -354,7 +358,7 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 354 |
|
| 355 |
gr.HTML("<div style='height:15px'></div>")
|
| 356 |
|
| 357 |
-
# 1. Quick Start Images
|
| 358 |
gr.Examples(
|
| 359 |
examples=[
|
| 360 |
["quick_tries_images/applecrisp.jpg"],
|
|
@@ -366,7 +370,7 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 366 |
|
| 367 |
gr.HTML("<div style='height:10px'></div>")
|
| 368 |
|
| 369 |
-
# 2. Convert Button
|
| 370 |
magic_btn = gr.Button("โจ Convert to Text", variant="primary")
|
| 371 |
|
| 372 |
# SECTION B: TEXT OUTPUT
|
|
@@ -411,6 +415,10 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 411 |
|
| 412 |
# --- VIEW 2: FEED ---
|
| 413 |
with gr.Column(visible=False) as feed_view:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
if not df_recipes.empty:
|
| 415 |
feed_samples = df_recipes.sample(10)
|
| 416 |
for index, row in feed_samples.iterrows():
|
|
@@ -418,6 +426,12 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 418 |
emoji = random.choice(["๐ฅ", "๐ฅ", "๐ฐ", "๐ฎ"])
|
| 419 |
post_time = random.choice(["2h", "3h", "6h", "Yesterday"])
|
| 420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
with gr.Group(elem_classes=["fb-card"]):
|
| 422 |
gr.HTML(f"""
|
| 423 |
<div class="post-header">
|
|
@@ -429,7 +443,17 @@ with gr.Blocks(title="CookBook") as demo:
|
|
| 429 |
</div>
|
| 430 |
""")
|
| 431 |
gr.Markdown(f"**{row['Title']}**")
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
|
| 434 |
with gr.Row(elem_classes=["post-actions"]):
|
| 435 |
gr.Button("๐ Like", elem_classes=["action-btn"], size="sm")
|
|
|
|
| 328 |
<div class="contact-name">Welcome Chef</div>
|
| 329 |
</div>
|
| 330 |
""")
|
| 331 |
+
|
| 332 |
+
# --- MODIFICATION 1: Separator Line below profile ---
|
| 333 |
+
gr.HTML("<hr style='border:0; border-top:1px solid #ced0d4; margin: 10px 0;'>")
|
| 334 |
+
|
| 335 |
nav_digital = gr.Button("โจ Digitalize Recipe", elem_classes=["nav-btn", "selected"])
|
| 336 |
nav_feed = gr.Button("๐ฐ News Feed", elem_classes=["nav-btn"])
|
| 337 |
nav_saved = gr.Button("๐ Saved Recipes", elem_classes=["nav-btn"])
|
|
|
|
| 358 |
|
| 359 |
gr.HTML("<div style='height:15px'></div>")
|
| 360 |
|
| 361 |
+
# 1. Quick Start Images
|
| 362 |
gr.Examples(
|
| 363 |
examples=[
|
| 364 |
["quick_tries_images/applecrisp.jpg"],
|
|
|
|
| 370 |
|
| 371 |
gr.HTML("<div style='height:10px'></div>")
|
| 372 |
|
| 373 |
+
# 2. Convert Button
|
| 374 |
magic_btn = gr.Button("โจ Convert to Text", variant="primary")
|
| 375 |
|
| 376 |
# SECTION B: TEXT OUTPUT
|
|
|
|
| 415 |
|
| 416 |
# --- VIEW 2: FEED ---
|
| 417 |
with gr.Column(visible=False) as feed_view:
|
| 418 |
+
|
| 419 |
+
# --- MODIFICATION 2: Feed Header ---
|
| 420 |
+
gr.Markdown("### ๐ฝ๏ธ Explore Our Recipes")
|
| 421 |
+
|
| 422 |
if not df_recipes.empty:
|
| 423 |
feed_samples = df_recipes.sample(10)
|
| 424 |
for index, row in feed_samples.iterrows():
|
|
|
|
| 426 |
emoji = random.choice(["๐ฅ", "๐ฅ", "๐ฐ", "๐ฎ"])
|
| 427 |
post_time = random.choice(["2h", "3h", "6h", "Yesterday"])
|
| 428 |
|
| 429 |
+
# PREPARE TEXT FOR "SEE MORE"
|
| 430 |
+
full_content = str(row['Raw_Output'])
|
| 431 |
+
# Split text: Preview (first 200 chars) vs Hidden (rest)
|
| 432 |
+
preview_text = full_content[:200]
|
| 433 |
+
hidden_text = full_content[200:]
|
| 434 |
+
|
| 435 |
with gr.Group(elem_classes=["fb-card"]):
|
| 436 |
gr.HTML(f"""
|
| 437 |
<div class="post-header">
|
|
|
|
| 443 |
</div>
|
| 444 |
""")
|
| 445 |
gr.Markdown(f"**{row['Title']}**")
|
| 446 |
+
|
| 447 |
+
# --- MODIFICATION 3: HTML Details/Summary for "See More" ---
|
| 448 |
+
gr.HTML(f"""
|
| 449 |
+
<div style="font-family: inherit; font-size: 14px;">
|
| 450 |
+
{preview_text}
|
| 451 |
+
<details style="display:inline;">
|
| 452 |
+
<summary style="cursor:pointer; color:#1877F2; font-weight:600; list-style:none; display:inline;">... See more</summary>
|
| 453 |
+
<span style="display:block; margin-top:5px;">{hidden_text}</span>
|
| 454 |
+
</details>
|
| 455 |
+
</div>
|
| 456 |
+
""")
|
| 457 |
|
| 458 |
with gr.Row(elem_classes=["post-actions"]):
|
| 459 |
gr.Button("๐ Like", elem_classes=["action-btn"], size="sm")
|