Spaces:
Runtime error
Runtime error
Commit
Β·
e0c919d
1
Parent(s):
8be9912
fix readme
Browse files
README.md
CHANGED
|
@@ -1,13 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Iqbal Poetry RAG System
|
| 2 |
|
| 3 |
A Retrieval-Augmented Generation (RAG) system for exploring and querying the poetry of Allama Iqbal. This project leverages vector search and large language models (LLMs) to answer questions about Iqbal's poetry, providing relevant poem excerpts as context.
|
| 4 |
|
| 5 |
---
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
## Features
|
| 8 |
|
| 9 |
- **Semantic Search**: Retrieve the most relevant poems for a given question using vector embeddings.
|
| 10 |
- **LLM-Powered Answers**: Generate answers using a language model, grounded in retrieved poem context.
|
|
|
|
|
|
|
| 11 |
- **Configurable**: Easily adjust retrieval thresholds, model settings, and data sources.
|
| 12 |
- **Error Handling**: Robust error management for smoother user experience.
|
| 13 |
- **(Optional) Feedback Logging**: Log user feedback for continuous improvement.
|
|
@@ -38,38 +70,43 @@ uv pip install -r requirements.txt
|
|
| 38 |
|
| 39 |
## Usage
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
|
| 44 |
```bash
|
| 45 |
python app/main.py
|
| 46 |
```
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
---
|
| 51 |
|
| 52 |
## Project Structure
|
| 53 |
|
| 54 |
-
```
|
| 55 |
iqbal_poetry_rag/
|
| 56 |
β
|
| 57 |
βββ app/
|
| 58 |
-
β
|
| 59 |
-
β
|
| 60 |
-
β
|
| 61 |
β
|
| 62 |
βββ rag/
|
| 63 |
-
β
|
| 64 |
-
β
|
| 65 |
-
β
|
| 66 |
β
|
| 67 |
βββ utils/
|
| 68 |
-
β
|
| 69 |
-
β
|
|
|
|
|
|
|
|
|
|
| 70 |
β
|
| 71 |
-
βββ requirements.txt
|
| 72 |
-
βββ README.md
|
| 73 |
```
|
| 74 |
|
| 75 |
---
|
|
@@ -79,7 +116,7 @@ iqbal_poetry_rag/
|
|
| 79 |
Edit `app/config.py` to set:
|
| 80 |
|
| 81 |
- `SCORE_THRESHOLD`: Minimum similarity score for retrieved poems.
|
| 82 |
-
- `JSON_FILE_PATH`: Path to your poems data file.
|
| 83 |
|
| 84 |
---
|
| 85 |
|
|
@@ -98,4 +135,10 @@ Contributions are welcome! Please open issues or submit pull requests for improv
|
|
| 98 |
## Acknowledgements
|
| 99 |
|
| 100 |
- Inspired by the poetry of Allama Iqbal.
|
| 101 |
-
- Built with Python, vector search, and LLM technologies.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: "Iqbal Poetry RAG System"
|
| 3 |
+
emoji: "π"
|
| 4 |
+
colorFrom: "yellow"
|
| 5 |
+
colorTo: "purple"
|
| 6 |
+
sdk: "gradio"
|
| 7 |
+
python_version: "3.10"
|
| 8 |
+
app_file: "app.py"
|
| 9 |
+
short_description: "A Gradio RAG app for exploring and querying the poetry of Allama Iqbal."
|
| 10 |
+
tags:
|
| 11 |
+
- rag
|
| 12 |
+
- poetry
|
| 13 |
+
- gradio
|
| 14 |
+
- iqbal
|
| 15 |
+
- language-models
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
# Iqbal Poetry RAG System
|
| 19 |
|
| 20 |
A Retrieval-Augmented Generation (RAG) system for exploring and querying the poetry of Allama Iqbal. This project leverages vector search and large language models (LLMs) to answer questions about Iqbal's poetry, providing relevant poem excerpts as context.
|
| 21 |
|
| 22 |
---
|
| 23 |
|
| 24 |
+
## π Hugging Face Spaces Ready
|
| 25 |
+
|
| 26 |
+
This project is ready to be deployed as a [Hugging Face Space](https://huggingface.co/spaces). The configuration block above (in YAML) tells Hugging Face how to launch the app:
|
| 27 |
+
- **sdk**: Uses Gradio for the web interface.
|
| 28 |
+
- **app_file**: Entry point for the app (`app/main.py`).
|
| 29 |
+
- **python_version**: Uses Python 3.10.
|
| 30 |
+
- **short_description**: Shown in the Space's thumbnail.
|
| 31 |
+
- **tags**: For discoverability.
|
| 32 |
+
|
| 33 |
+
To deploy, simply upload this repository to your Hugging Face account as a new Space.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
## Features
|
| 38 |
|
| 39 |
- **Semantic Search**: Retrieve the most relevant poems for a given question using vector embeddings.
|
| 40 |
- **LLM-Powered Answers**: Generate answers using a language model, grounded in retrieved poem context.
|
| 41 |
+
- **Gradio Interface**: User-friendly web interface powered by [Gradio](https://gradio.app/).
|
| 42 |
+
- **Plug-and-Play Dataset**: The poetry dataset is already included in the repository, with all paths set up for immediate use.
|
| 43 |
- **Configurable**: Easily adjust retrieval thresholds, model settings, and data sources.
|
| 44 |
- **Error Handling**: Robust error management for smoother user experience.
|
| 45 |
- **(Optional) Feedback Logging**: Log user feedback for continuous improvement.
|
|
|
|
| 70 |
|
| 71 |
## Usage
|
| 72 |
|
| 73 |
+
**Just plug and run!**
|
| 74 |
+
The poetry dataset is already included in the repository, and all file paths are set up using relative paths. No additional data preparation is required.
|
| 75 |
+
|
| 76 |
+
To launch the Gradio app locally:
|
| 77 |
|
| 78 |
```bash
|
| 79 |
python app/main.py
|
| 80 |
```
|
| 81 |
|
| 82 |
+
This will start a Gradio web interface in your browser, where you can enter your questions about Iqbal's poetry and receive contextually grounded answers.
|
| 83 |
|
| 84 |
---
|
| 85 |
|
| 86 |
## Project Structure
|
| 87 |
|
| 88 |
+
```
|
| 89 |
iqbal_poetry_rag/
|
| 90 |
β
|
| 91 |
βββ app/
|
| 92 |
+
β βββ RAGSystem.py # Main RAG system class
|
| 93 |
+
β βββ main.py # Entry point for the Gradio app
|
| 94 |
+
β βββ config.py # Configuration (thresholds, file paths, etc.)
|
| 95 |
β
|
| 96 |
βββ rag/
|
| 97 |
+
β βββ vector_store.py # Vector store initialization and building
|
| 98 |
+
β βββ retriever.py # Retriever configuration
|
| 99 |
+
β βββ llm.py # LLM initialization and prompt management
|
| 100 |
β
|
| 101 |
βββ utils/
|
| 102 |
+
β βββ error_handling.py # Error handling decorators
|
| 103 |
+
β βββ feedback_logger.py # (Optional) Feedback logging
|
| 104 |
+
β
|
| 105 |
+
βββ dataset/
|
| 106 |
+
β βββ poems.json # Iqbal's poetry dataset (already included)
|
| 107 |
β
|
| 108 |
+
βββ requirements.txt # Project dependencies
|
| 109 |
+
βββ README.md # This file
|
| 110 |
```
|
| 111 |
|
| 112 |
---
|
|
|
|
| 116 |
Edit `app/config.py` to set:
|
| 117 |
|
| 118 |
- `SCORE_THRESHOLD`: Minimum similarity score for retrieved poems.
|
| 119 |
+
- `JSON_FILE_PATH`: Path to your poems data file (already set to the included dataset).
|
| 120 |
|
| 121 |
---
|
| 122 |
|
|
|
|
| 135 |
## Acknowledgements
|
| 136 |
|
| 137 |
- Inspired by the poetry of Allama Iqbal.
|
| 138 |
+
- Built with Python, Gradio, vector search, and LLM technologies.
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## References
|
| 143 |
+
|
| 144 |
+
- [Hugging Face Spaces Configuration Reference](https://huggingface.co/docs/hub/spaces-config-reference)
|