Liori25 commited on
Commit
d6104de
·
verified ·
1 Parent(s): 09ac334

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -111
app.py CHANGED
@@ -141,11 +141,24 @@ theme = gr.themes.Default(
141
  )
142
 
143
  facebook_css = """
144
- body { background-color: #f0f2f5; margin: 0; padding: 0; }
145
- .gradio-container { background-color: #f0f2f5 !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  footer { display: none !important; }
147
 
148
- /* 1. STICKY NAVBAR */
149
  .fb-navbar {
150
  background: white;
151
  height: 56px;
@@ -153,99 +166,75 @@ footer { display: none !important; }
153
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
154
  display: flex;
155
  align-items: center;
156
- position: sticky;
157
  top: 0;
 
 
158
  z-index: 999;
159
  justify-content: space-between;
160
  }
161
  .fb-logo {
162
- color: #1877F2;
163
- font-size: 28px;
164
- font-weight: 800;
165
- letter-spacing: -0.5px;
166
- margin-right: 20px;
167
- font-family: Helvetica, Arial, sans-serif;
168
  }
169
  .fb-search {
170
- background: #f0f2f5;
171
- border-radius: 50px;
172
- padding: 10px 20px;
173
- color: #65676B;
174
- width: 250px;
175
- display: flex;
176
- align-items: center;
177
  }
178
 
179
- /* 2. LAYOUT COLUMNS */
 
180
  .main-layout {
181
  display: flex;
182
  justify-content: center;
183
- padding-top: 20px;
184
  gap: 20px;
185
- max-width: 1600px;
186
  margin: 0 auto;
187
- align-items: flex-start;
 
188
  }
189
 
190
- /* FIXED SIDEBARS */
191
  .col-left {
192
- width: 200px !important;
193
- min-width: 200px !important;
194
  flex-shrink: 0;
195
- display: none;
196
- position: sticky;
197
- top: 76px;
198
- height: calc(100vh - 80px);
199
- overflow-y: auto;
200
- scrollbar-width: none;
201
  }
202
 
 
203
  .col-feed {
204
  flex-grow: 1;
205
- min-width: 600px;
206
- max-width: 1000px;
 
 
 
 
207
  }
 
208
 
 
209
  .col-right {
210
- width: 240px !important;
211
- min-width: 240px !important;
212
  flex-shrink: 0;
213
- display: none;
214
- position: sticky;
215
- top: 76px;
216
- height: calc(100vh - 80px);
217
- overflow-y: auto;
218
- scrollbar-width: none;
219
  }
220
 
221
  /* 3. CARD STYLING */
222
  .fb-card {
223
- background: white;
224
- border-radius: 10px;
225
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
226
- margin-bottom: 25px;
227
- overflow: hidden;
228
- padding: 16px;
229
- border: 1px solid #e4e6eb;
230
  }
231
 
232
  /* 4. NAVIGATION BUTTONS */
233
  .nav-btn {
234
- width: 100% !important;
235
- height: 42.5px !important;
236
- text-align: left !important;
237
- justify-content: flex-start !important;
238
- background: transparent !important;
239
- border: none !important;
240
- box-shadow: none !important;
241
- color: #050505 !important;
242
- font-weight: 600 !important;
243
- font-size: 15px !important;
244
- padding: 0 12px !important;
245
- border-radius: 8px !important;
246
- margin-bottom: 5px !important;
247
- display: flex !important;
248
- align-items: center !important;
249
  }
250
  .nav-btn:hover { background-color: #e4e6eb !important; }
251
  .nav-btn.selected { background-color: #e7f3ff !important; color: #1877f2 !important; }
@@ -258,68 +247,28 @@ footer { display: none !important; }
258
  .post-meta { font-size: 13px; color: #65676B; }
259
 
260
  /* 6. POST ACTIONS */
261
- .post-actions {
262
- border-top: 1px solid #ced0d4;
263
- margin-top: 10px;
264
- padding-top: 5px;
265
- display: flex;
266
- justify-content: space-around;
267
- }
268
  .action-btn { background: transparent !important; color: #65676B !important; box-shadow: none !important; }
269
  .action-btn:hover { background: #f2f2f2 !important; }
270
 
271
  /* 7. CONTACTS */
272
- .contact-row {
273
- display: flex; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer;
274
- }
275
  .contact-row:hover { background-color: #e4e6eb; }
276
  .contact-name { font-weight: 500; font-size: 14px; margin-left: 10px; color: #050505; }
277
  .profile-row { display: flex; align-items: center; padding: 8px; border-radius: 8px; }
278
 
279
  /* 8. EXAMPLES */
280
  button.gallery-item { border: none !important; background: transparent !important; padding: 4px !important; }
281
- button.gallery-item img {
282
- width: 110px !important; height: 110px !important; border-radius: 12px !important;
283
- transition: all 0.3s ease !important; object-fit: cover; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
284
- }
285
- button.gallery-item:hover img {
286
- transform: scale(1.15) !important; box-shadow: 0 8px 15px rgba(24, 119, 242, 0.3) !important; z-index: 10;
287
- }
288
 
289
  /* 9. SEE MORE LOGIC */
290
  details[open] > summary { display: none !important; }
291
 
292
  /* 10. MODERN UPLOAD IMAGE */
293
- .modern-image-container button {
294
- border-radius: 8px !important;
295
- overflow: hidden !important;
296
- border: 1px solid #e4e6eb !important;
297
- box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
298
- padding: 0 !important;
299
- }
300
- .modern-image-container img {
301
- border-radius: 8px !important;
302
- width: 100% !important;
303
- max-height: 400px !important;
304
- object-fit: cover !important;
305
- }
306
- .modern-image-container .download-button,
307
- .modern-image-container .share-button,
308
- .modern-image-container button[title="Download"],
309
- .modern-image-container button[title="Share"] {
310
- display: none !important;
311
- }
312
-
313
- /* 11. REMOVE "GRAY SQUARE" (Gradio Column Artifacts) */
314
- .feed-container {
315
- background: transparent !important;
316
- border: none !important;
317
- box-shadow: none !important;
318
- padding: 0 !important;
319
- gap: 0 !important;
320
- }
321
- /* Ensure inner form elements don't add borders either */
322
- .feed-container > .form { border: none !important; background: transparent !important; }
323
 
324
  /* UTILS */
325
  .sim-scroll { height: 200px; overflow-y: auto; font-size: 13px; color: #050505; }
@@ -388,6 +337,7 @@ with gr.Blocks(title="CookBook") as demo:
388
  gr.HTML("<hr style='border:0; border-top:1px solid #e4e6eb; margin: 10px 0;'>")
389
 
390
  with gr.Row():
 
391
  input_img = gr.Image(
392
  type="filepath",
393
  label="Upload Recipe",
@@ -456,8 +406,7 @@ with gr.Blocks(title="CookBook") as demo:
456
  magic_btn.click(ui_update_pipeline, input_img, [out_text, sim1, c1_btns, c2_box, sim2, c3_box, sim3])
457
 
458
  # --- VIEW 2: FEED ---
459
- # ADDED CLASS feed-container to remove the "Gray Square"
460
- with gr.Column(visible=False, elem_classes=["feed-container"]) as feed_view:
461
  gr.Markdown("### 🍽️ Explore Our Recipes")
462
 
463
  if not df_recipes.empty:
 
141
  )
142
 
143
  facebook_css = """
144
+ /* GLOBAL LOCK: This stops the whole page from scrolling */
145
+ body, html {
146
+ background-color: #f0f2f5;
147
+ margin: 0;
148
+ padding: 0;
149
+ height: 100vh; /* Force height to screen size */
150
+ overflow: hidden !important; /* Hide main scrollbar */
151
+ }
152
+ .gradio-container {
153
+ background-color: #f0f2f5 !important;
154
+ max-width: 100% !important;
155
+ margin: 0 !important;
156
+ padding: 0 !important;
157
+ height: 100vh !important;
158
+ }
159
  footer { display: none !important; }
160
 
161
+ /* 1. FIXED NAVBAR */
162
  .fb-navbar {
163
  background: white;
164
  height: 56px;
 
166
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
167
  display: flex;
168
  align-items: center;
169
+ position: fixed; /* Fixed at top */
170
  top: 0;
171
+ left: 0;
172
+ right: 0;
173
  z-index: 999;
174
  justify-content: space-between;
175
  }
176
  .fb-logo {
177
+ color: #1877F2; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-right: 20px; font-family: Helvetica, Arial, sans-serif;
 
 
 
 
 
178
  }
179
  .fb-search {
180
+ background: #f0f2f5; border-radius: 50px; padding: 10px 20px; color: #65676B; width: 250px; display: flex; align-items: center;
 
 
 
 
 
 
181
  }
182
 
183
+ /* 2. LAYOUT COLUMNS - INDEPENDENT SCROLLING */
184
+ /* This container sits below the navbar and fills the screen */
185
  .main-layout {
186
  display: flex;
187
  justify-content: center;
188
+ padding-top: 56px; /* Push down by navbar height */
189
  gap: 20px;
190
+ max-width: 100%;
191
  margin: 0 auto;
192
+ height: 100vh; /* Fill screen */
193
+ box-sizing: border-box;
194
  }
195
 
196
+ /* LEFT SIDEBAR: Fixed, no scroll */
197
  .col-left {
198
+ width: 280px !important;
199
+ min-width: 280px !important;
200
  flex-shrink: 0;
201
+ height: 100%;
202
+ overflow-y: hidden; /* No scroll */
203
+ padding: 20px;
204
+ display: none; /* Mobile hidden */
 
 
205
  }
206
 
207
+ /* CENTER FEED: THIS IS THE ONLY THING THAT SCROLLS */
208
  .col-feed {
209
  flex-grow: 1;
210
+ min-width: 500px;
211
+ max-width: 800px;
212
+ height: 100%;
213
+ overflow-y: auto; /* Scrollable! */
214
+ padding: 20px 0 100px 0; /* Padding for bottom spacing */
215
+ scrollbar-width: none; /* Hide scrollbar for aesthetics */
216
  }
217
+ .col-feed::-webkit-scrollbar { display: none; }
218
 
219
+ /* RIGHT SIDEBAR: Fixed, no scroll */
220
  .col-right {
221
+ width: 280px !important;
222
+ min-width: 280px !important;
223
  flex-shrink: 0;
224
+ height: 100%;
225
+ overflow-y: hidden; /* No scroll */
226
+ padding: 20px;
227
+ display: none; /* Mobile hidden */
 
 
228
  }
229
 
230
  /* 3. CARD STYLING */
231
  .fb-card {
232
+ background: white; border-radius: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 25px; overflow: hidden; padding: 16px; border: 1px solid #e4e6eb;
 
 
 
 
 
 
233
  }
234
 
235
  /* 4. NAVIGATION BUTTONS */
236
  .nav-btn {
237
+ width: 100% !important; height: 48px !important; text-align: left !important; justify-content: flex-start !important; background: transparent !important; border: none !important; box-shadow: none !important; color: #050505 !important; font-weight: 600 !important; font-size: 15px !important; padding: 0 12px !important; border-radius: 8px !important; margin-bottom: 5px !important; display: flex !important; align-items: center !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
  .nav-btn:hover { background-color: #e4e6eb !important; }
240
  .nav-btn.selected { background-color: #e7f3ff !important; color: #1877f2 !important; }
 
247
  .post-meta { font-size: 13px; color: #65676B; }
248
 
249
  /* 6. POST ACTIONS */
250
+ .post-actions { border-top: 1px solid #ced0d4; margin-top: 10px; padding-top: 5px; display: flex; justify-content: space-around; }
 
 
 
 
 
 
251
  .action-btn { background: transparent !important; color: #65676B !important; box-shadow: none !important; }
252
  .action-btn:hover { background: #f2f2f2 !important; }
253
 
254
  /* 7. CONTACTS */
255
+ .contact-row { display: flex; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; }
 
 
256
  .contact-row:hover { background-color: #e4e6eb; }
257
  .contact-name { font-weight: 500; font-size: 14px; margin-left: 10px; color: #050505; }
258
  .profile-row { display: flex; align-items: center; padding: 8px; border-radius: 8px; }
259
 
260
  /* 8. EXAMPLES */
261
  button.gallery-item { border: none !important; background: transparent !important; padding: 4px !important; }
262
+ button.gallery-item img { width: 110px !important; height: 110px !important; border-radius: 12px !important; transition: all 0.3s ease !important; object-fit: cover; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
263
+ button.gallery-item:hover img { transform: scale(1.15) !important; box-shadow: 0 8px 15px rgba(24, 119, 242, 0.3) !important; z-index: 10; }
 
 
 
 
 
264
 
265
  /* 9. SEE MORE LOGIC */
266
  details[open] > summary { display: none !important; }
267
 
268
  /* 10. MODERN UPLOAD IMAGE */
269
+ .modern-image-container button { border-radius: 8px !important; overflow: hidden !important; border: 1px solid #e4e6eb !important; box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important; padding: 0 !important; }
270
+ .modern-image-container img { border-radius: 8px !important; width: 100% !important; max-height: 400px !important; object-fit: cover !important; }
271
+ .modern-image-container .download-button, .modern-image-container .share-button, .modern-image-container button[title="Download"], .modern-image-container button[title="Share"] { display: none !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
  /* UTILS */
274
  .sim-scroll { height: 200px; overflow-y: auto; font-size: 13px; color: #050505; }
 
337
  gr.HTML("<hr style='border:0; border-top:1px solid #e4e6eb; margin: 10px 0;'>")
338
 
339
  with gr.Row():
340
+ # FIXED: Image upload without crash
341
  input_img = gr.Image(
342
  type="filepath",
343
  label="Upload Recipe",
 
406
  magic_btn.click(ui_update_pipeline, input_img, [out_text, sim1, c1_btns, c2_box, sim2, c3_box, sim3])
407
 
408
  # --- VIEW 2: FEED ---
409
+ with gr.Column(visible=False) as feed_view:
 
410
  gr.Markdown("### 🍽️ Explore Our Recipes")
411
 
412
  if not df_recipes.empty: