Spaces:
Runtime error
Runtime error
File size: 1,693 Bytes
887ed08 2ac67dc 887ed08 2ac67dc 887ed08 2ac67dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ---
title: Plutus Learning Recommender
emoji: 📚
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
---
# Plutus Learning Material Recommender
Simple content-based recommendation system built on the Plutus Learner RAG corpus.
## Features
- BM25 ranking (pure Python, zero heavy dependencies)
- Query-based recommendations
- Topic-based recommendations
- Filter by tool (plinth / cardano)
- Runs on Colab CPU and free Hugging Face CPU Spaces
## Local / Colab usage
```bash
# In the plutus_recommender folder
python recommender.py "What is the difference between datum and redeemer?"
```
Or in a notebook:
```python
from recommender import PlutusRecommender
rec = PlutusRecommender()
results = rec.recommend("Plutus V3 validators and ScriptContext", k=5)
for r in results:
print(r["title"], r["score"], r["url"])
```
## Deploy to Hugging Face Space (CPU)
1. Create a new **Gradio** Space on Hugging Face.
2. Upload the entire `plutus_recommender/` folder contents:
- `app.py`
- `recommender.py`
- `rag.py`
- `data/` (the index folder)
- `requirements.txt`
- `README.md` (this file)
3. The Space will start automatically. No GPU needed.
## Optional: Dense / Hybrid mode
For semantic recommendations install FastEmbed (still CPU):
```bash
pip install fastembed numpy
```
Then in code:
```python
# First build vectors (one-time, in Colab)
from rag import embed_index
embed_index("data/index")
# Then
rec = PlutusRecommender(mode="hybrid")
```
## Corpus note
The bundled index contains 15 bootstrap summary chunks.
To expand the corpus, use the original `ingest.py` from the RAG bundle against `sources.json`.
|