BasitAliii commited on
Commit
6dedcae
Β·
verified Β·
1 Parent(s): 8703406

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -12
app.py CHANGED
@@ -221,6 +221,7 @@ with left:
221
  st.markdown(f"🎯 **Wants:** {', '.join(p.wants) or 'β€”'}")
222
  st.markdown("</div>", unsafe_allow_html=True)
223
 
 
224
  # ---------- AI MATCHMAKING ----------
225
  with right:
226
  st.subheader("πŸ€– AI Matchmaking")
@@ -248,21 +249,36 @@ with right:
248
  3,
249
  )
250
 
251
- # ====== FIXED PROGRESS BAR & SCORE DISPLAY ======
252
- for m in matches:
253
- st.markdown("<div class='card'>", unsafe_allow_html=True)
254
- st.markdown(f"### {m.get('username')}")
255
-
256
- # Convert score 0-1 β†’ 0-100%
257
- raw_score = float(m.get("score", 0))
258
- raw_score = max(0.0, min(1.0, raw_score))
259
- score_percent = int(raw_score * 100)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
- st.progress(raw_score) # progress bar expects 0-1
262
- st.caption(f"Match Score: {score_percent}%")
263
- st.caption(m.get("reason", "AI Match"))
264
  st.markdown("</div>", unsafe_allow_html=True)
265
 
 
266
  # ---------- FEEDBACK ----------
267
  with st.sidebar:
268
  st.markdown("---")
 
221
  st.markdown(f"🎯 **Wants:** {', '.join(p.wants) or 'β€”'}")
222
  st.markdown("</div>", unsafe_allow_html=True)
223
 
224
+ # ---------- AI MATCHMAKING ----------
225
  # ---------- AI MATCHMAKING ----------
226
  with right:
227
  st.subheader("πŸ€– AI Matchmaking")
 
249
  3,
250
  )
251
 
252
+ if not matches:
253
+ st.info("No matches found.")
254
+ else:
255
+ st.markdown("<div class='matches-container'>", unsafe_allow_html=True)
256
+
257
+ for m in matches:
258
+ score_percent = int(float(m.get("score", 0)) * 100) # Convert 0-1 to 0-100%
259
+ st.markdown("<div class='card'>", unsafe_allow_html=True)
260
+ cols = st.columns([1, 3])
261
+
262
+ with cols[0]:
263
+ avatar_path = m.get("avatar")
264
+ if avatar_path and Path(avatar_path).exists():
265
+ st.image(avatar_path, width=80)
266
+ else:
267
+ st.image("https://via.placeholder.com/80", width=80)
268
+
269
+ with cols[1]:
270
+ st.markdown(f"### {m.get('username', 'Unknown')}")
271
+ st.markdown(f"🧠 Offers: {', '.join(m.get('offers', [])) or 'β€”'}")
272
+ st.markdown(f"🎯 Wants: {', '.join(m.get('wants', [])) or 'β€”'}")
273
+ st.markdown(f"⏰ {m.get('availability', 'N/A')} β€’ πŸ—£ {m.get('preferences', 'β€”')}")
274
+ st.markdown(f"**Match Score:** {score_percent}%")
275
+ st.caption(m.get("reason", "AI Match"))
276
+
277
+ st.markdown("</div>", unsafe_allow_html=True)
278
 
 
 
 
279
  st.markdown("</div>", unsafe_allow_html=True)
280
 
281
+
282
  # ---------- FEEDBACK ----------
283
  with st.sidebar:
284
  st.markdown("---")