Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -291,4 +291,26 @@ st.markdown("""
|
|
291 |
<p>Made with ❤️ for spiritual seekers worldwide</p>
|
292 |
<p>💎 <a href="#" style="color: #6366F1;">Upgrade to Pro</a> | 📧 [email protected] | 🌐 soulcompass.ai</p>
|
293 |
</div>
|
294 |
-
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
<p>Made with ❤️ for spiritual seekers worldwide</p>
|
292 |
<p>💎 <a href="#" style="color: #6366F1;">Upgrade to Pro</a> | 📧 [email protected] | 🌐 soulcompass.ai</p>
|
293 |
</div>
|
294 |
+
""", unsafe_allow_html=True)
|
295 |
+
# app.py 內適當位置(例如新增一個 Tab 或在抽牌後呼叫)
|
296 |
+
import rag_utils
|
297 |
+
|
298 |
+
with st.expander("🔎 Tarot / Numerology 知識查詢(RAG)"):
|
299 |
+
q = st.text_input("輸入關鍵字(例如:new beginnings, career change, love advice ...)")
|
300 |
+
target = st.radio("資料庫", ["Tarot", "Numerology"], horizontal=True)
|
301 |
+
k = st.slider("Top K", 1, 5, 3)
|
302 |
+
|
303 |
+
if q:
|
304 |
+
if target == "Tarot":
|
305 |
+
hits = rag_utils.search_tarot(q, k=k)
|
306 |
+
else:
|
307 |
+
hits = rag_utils.search_numerology(q, k=k)
|
308 |
+
|
309 |
+
for h in hits:
|
310 |
+
st.markdown(f"**#{h['rank']} • score {h['score']:.3f}**")
|
311 |
+
if 'card_name' in h:
|
312 |
+
st.markdown(f"🃏 **{h['card_name']}**")
|
313 |
+
if 'number' in h:
|
314 |
+
st.markdown(f"🔢 **Number {h['number']}**")
|
315 |
+
st.write(h['text'])
|
316 |
+
st.markdown("---")
|