Spaces:
Sleeping
Sleeping
metadata
title: 06-knowledge-graph
app_file: interface.py
sdk: gradio
sdk_version: 4.44.1
Knowledge Graph Project README
Overview
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.
Features
- Fetches and aggregates content from multiple RSS news feeds
- Processes text using LLM-based knowledge extraction
- Builds a directed graph of entities and their relationships
- Provides an interactive visualization using Plotly
- Allows selection of specific news sources
Installation
- Clone the repository
- Install the required dependencies:
pip install -r requirements.txt
- Download the required spaCy model:
python -m spacy download en_core_web_sm
Usage
Run the Gradio interface:
python interface.py
The interface allows you to:
- Select which news sources to include
- Generate a knowledge graph from the selected sources
- View the aggregated feed content and interactive graph visualization
Project Structure
interface.py
: Main Gradio application with the UI and visualization logicfetch.py
: Functions for retrieving and parsing RSS feedssources.py
: List of available RSS feed URLsrequirements.txt
: Required Python packagestutorials/
: Example notebooks showing the knowledge graph extraction process
How It Works
- The application fetches recent articles from selected RSS feeds
- Content is processed and split into manageable chunks
- An LLM (GPT-4o) extracts entities and relationships from the text
- A directed graph is constructed from these relationships
- The graph is visualized using Plotly with interactive features
Dependencies
- spaCy: For NLP processing
- Gradio: For the web interface
- NetworkX: For graph data structures
- Plotly: For interactive visualizations
- LangChain: For LLM-based graph transformations
- OpenAI API: Powers the LLM graph transformer
Acknowledgements
This project was inspired by techniques from:
- Analytics Vidhya: How to Build Knowledge Graph from Text using spaCy
- DataCamp: Knowledge Graph RAG Tutorial
Part of 30 Agents in 30 Days
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.