Liori25 commited on
Commit
a14204c
·
verified ·
1 Parent(s): 11af6f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -59,22 +59,17 @@ def find_similar_recipes_list(query_text):
59
  query_vec = get_embedding_via_api("Represent this recipe for retrieving similar dishes: " + query_text)
60
  if len(query_vec.shape) == 1: query_vec = query_vec.reshape(1, -1)
61
 
62
- # Calculate scores
63
  scores = cosine_similarity(query_vec, stored_embeddings)[0]
64
  top_indices = scores.argsort()[-3:][::-1]
65
 
66
  results_list = []
67
  for idx in top_indices:
68
- # Get the specific score for this match
69
  score = scores[idx]
70
  row = df_recipes.iloc[idx]
71
  title = row['Title']
72
  desc = str(row['Raw_Output'])
73
-
74
- # Format score as a percentage (e.g. 0.85 -> 85%)
75
  score_display = f"{score:.0%}"
76
 
77
- # Added the score to the HTML string
78
  card_content = (
79
  f"### 🏆 {title}\n"
80
  f"<span style='color:#1877f2; font-weight:bold; font-size:14px;'>Match Score: {score_display}</span>\n\n"
@@ -183,8 +178,10 @@ body, .gradio-container { background-color: #f0f2f5; }
183
  gap: 0px !important;
184
  }
185
 
 
186
  .content-card {
187
- background: white;
 
188
  border-radius: 12px;
189
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
190
  border: 1px solid #ddd;
@@ -263,7 +260,7 @@ with gr.Blocks(title="Legacy Kitchen") as demo:
263
  <span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
264
  </div>
265
  </div>
266
- <div style="color: #65676b; font-weight: 600;">v4.2</div>
267
  </div>
268
  """)
269
 
 
59
  query_vec = get_embedding_via_api("Represent this recipe for retrieving similar dishes: " + query_text)
60
  if len(query_vec.shape) == 1: query_vec = query_vec.reshape(1, -1)
61
 
 
62
  scores = cosine_similarity(query_vec, stored_embeddings)[0]
63
  top_indices = scores.argsort()[-3:][::-1]
64
 
65
  results_list = []
66
  for idx in top_indices:
 
67
  score = scores[idx]
68
  row = df_recipes.iloc[idx]
69
  title = row['Title']
70
  desc = str(row['Raw_Output'])
 
 
71
  score_display = f"{score:.0%}"
72
 
 
73
  card_content = (
74
  f"### 🏆 {title}\n"
75
  f"<span style='color:#1877f2; font-weight:bold; font-size:14px;'>Match Score: {score_display}</span>\n\n"
 
178
  gap: 0px !important;
179
  }
180
 
181
+ /* UPDATED: Forced White Background */
182
  .content-card {
183
+ background-color: #ffffff !important;
184
+ background: #ffffff !important;
185
  border-radius: 12px;
186
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
187
  border: 1px solid #ddd;
 
260
  <span class="app-slogan">Turning Handwritten Notes into a Digital Cookbook.</span>
261
  </div>
262
  </div>
263
+ <div style="color: #65676b; font-weight: 600;">v4.3</div>
264
  </div>
265
  """)
266