Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +71 -3
- requirements.txt +2 -1
README.md
CHANGED
@@ -4,7 +4,75 @@ app_file: interface.py
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.44.1
|
6 |
---
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.44.1
|
6 |
---
|
7 |
+
# Knowledge Graph Project README
|
8 |
|
9 |
+
## Overview
|
10 |
+
|
11 |
+
This project creates an interactive knowledge graph visualization from RSS feeds. It extracts entities and relationships from news articles using NLP and LLM-based techniques, then visualizes the connections in an interactive graph.
|
12 |
+
|
13 |
+
## Features
|
14 |
+
|
15 |
+
- Fetches and aggregates content from multiple RSS news feeds
|
16 |
+
- Processes text using LLM-based knowledge extraction
|
17 |
+
- Builds a directed graph of entities and their relationships
|
18 |
+
- Provides an interactive visualization using Plotly
|
19 |
+
- Allows selection of specific news sources
|
20 |
+
|
21 |
+
## Installation
|
22 |
+
|
23 |
+
1. Clone the repository
|
24 |
+
2. Install the required dependencies:
|
25 |
+
```bash
|
26 |
+
pip install -r requirements.txt
|
27 |
+
```
|
28 |
+
3. Download the required spaCy model:
|
29 |
+
```bash
|
30 |
+
python -m spacy download en_core_web_sm
|
31 |
+
```
|
32 |
+
|
33 |
+
## Usage
|
34 |
+
|
35 |
+
Run the Gradio interface:
|
36 |
+
```bash
|
37 |
+
python interface.py
|
38 |
+
```
|
39 |
+
|
40 |
+
The interface allows you to:
|
41 |
+
1. Select which news sources to include
|
42 |
+
2. Generate a knowledge graph from the selected sources
|
43 |
+
3. View the aggregated feed content and interactive graph visualization
|
44 |
+
|
45 |
+
## Project Structure
|
46 |
+
|
47 |
+
- `interface.py`: Main Gradio application with the UI and visualization logic
|
48 |
+
- `fetch.py`: Functions for retrieving and parsing RSS feeds
|
49 |
+
- `sources.py`: List of available RSS feed URLs
|
50 |
+
- `requirements.txt`: Required Python packages
|
51 |
+
- `tutorials/`: Example notebooks showing the knowledge graph extraction process
|
52 |
+
|
53 |
+
## How It Works
|
54 |
+
|
55 |
+
1. The application fetches recent articles from selected RSS feeds
|
56 |
+
2. Content is processed and split into manageable chunks
|
57 |
+
3. An LLM (GPT-4o) extracts entities and relationships from the text
|
58 |
+
4. A directed graph is constructed from these relationships
|
59 |
+
5. The graph is visualized using Plotly with interactive features
|
60 |
+
|
61 |
+
## Dependencies
|
62 |
+
|
63 |
+
- spaCy: For NLP processing
|
64 |
+
- Gradio: For the web interface
|
65 |
+
- NetworkX: For graph data structures
|
66 |
+
- Plotly: For interactive visualizations
|
67 |
+
- LangChain: For LLM-based graph transformations
|
68 |
+
- OpenAI API: Powers the LLM graph transformer
|
69 |
+
|
70 |
+
## Acknowledgements
|
71 |
+
|
72 |
+
This project was inspired by techniques from:
|
73 |
+
- [Analytics Vidhya: How to Build Knowledge Graph from Text using spaCy](https://www.analyticsvidhya.com/blog/2019/10/how-to-build-knowledge-graph-text-using-spacy/)
|
74 |
+
- [DataCamp: Knowledge Graph RAG Tutorial](https://www.datacamp.com/tutorial/knowledge-graph-rag)
|
75 |
+
|
76 |
+
## Part of 30 Agents in 30 Days
|
77 |
+
|
78 |
+
This project is #6 in the **30 Agents in 30 Days** series, which provides practical AI agent workflows for different stages of product development including research, development, testing, marketing, and sales.
|
requirements.txt
CHANGED
@@ -8,4 +8,5 @@ matplotlib
|
|
8 |
pyvis
|
9 |
plotly
|
10 |
langchain
|
11 |
-
langchain_experimental
|
|
|
|
8 |
pyvis
|
9 |
plotly
|
10 |
langchain
|
11 |
+
langchain_experimental
|
12 |
+
langchain_openai
|