Commit ·
d293e15
1
Parent(s): 3f5d323
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,90 +1,20 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
- OpenAI API key
|
| 22 |
-
|
| 23 |
-
### Dependencies
|
| 24 |
-
|
| 25 |
-
The application requires the following Python packages:
|
| 26 |
-
|
| 27 |
-
- langchain (>= 0.1.0): Core LLM framework
|
| 28 |
-
- langchain-experimental (>= 0.0.45): Experimental LangChain features
|
| 29 |
-
- langchain-openai (>= 0.1.0): OpenAI integration for LangChain
|
| 30 |
-
- python-dotenv (>= 1.0.0): Environment variable support
|
| 31 |
-
- pyvis (>= 0.3.2): Graph visualization
|
| 32 |
-
- streamlit (>= 1.32.0): Web UI framework
|
| 33 |
-
|
| 34 |
-
Install all required dependencies using the provided requirements.txt file:
|
| 35 |
-
|
| 36 |
-
```bash
|
| 37 |
-
pip install -r requirements.txt
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
### Setup
|
| 41 |
-
|
| 42 |
-
1. Clone this repository:
|
| 43 |
-
```bash
|
| 44 |
-
git clone [repository-url]
|
| 45 |
-
cd knowledge_graph_app_2
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
Note: Replace `[repository-url]` with the actual URL of this repository.
|
| 49 |
-
|
| 50 |
-
2. Create a `.env` file in the root directory with your OpenAI API key:
|
| 51 |
-
```
|
| 52 |
-
OPENAI_API_KEY=your_openai_api_key_here
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
## Running the Application
|
| 56 |
-
|
| 57 |
-
To run the Streamlit app:
|
| 58 |
-
|
| 59 |
-
```bash
|
| 60 |
-
streamlit run app.py
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
This will start the application and open it in your default web browser (typically at http://localhost:8501).
|
| 64 |
-
|
| 65 |
-
## Usage
|
| 66 |
-
|
| 67 |
-
1. Choose your input method from the sidebar (Upload txt or Input text)
|
| 68 |
-
2. If uploading a file, select a .txt file from your computer
|
| 69 |
-
3. If using direct input, type or paste your text into the text area
|
| 70 |
-
4. Click the "Generate Knowledge Graph" button
|
| 71 |
-
5. Wait for the graph to be generated (this may take a few moments depending on the length of the text)
|
| 72 |
-
6. Explore the interactive knowledge graph:
|
| 73 |
-
- Drag nodes to rearrange the graph
|
| 74 |
-
- Hover over nodes and edges to see additional information
|
| 75 |
-
- Zoom in/out using the mouse wheel
|
| 76 |
-
- Filter the graph for specific nodes and edges.
|
| 77 |
-
|
| 78 |
-
## How It Works
|
| 79 |
-
|
| 80 |
-
The application uses LangChain's experimental graph transformers with OpenAI's GPT-4o model to:
|
| 81 |
-
1. Extract entities from the input text
|
| 82 |
-
2. Identify relationships between these entities
|
| 83 |
-
3. Generate a graph structure representing this information
|
| 84 |
-
4. Visualize the graph using PyVis, a Python interface for the vis.js visualization library
|
| 85 |
-
|
| 86 |
-
## License
|
| 87 |
-
|
| 88 |
-
This project is licensed under the MIT License - a permissive open source license that allows for free use, modification, and distribution of the software.
|
| 89 |
-
|
| 90 |
-
For more details, see the [MIT License](https://opensource.org/licenses/MIT) documentation.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Knowledge Graph Generator
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 8501
|
| 8 |
+
tags:
|
| 9 |
+
- streamlit
|
| 10 |
+
pinned: false
|
| 11 |
+
short_description: Extract graph data from text input and generates interactive
|
| 12 |
+
license: mit
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Welcome to Streamlit!
|
| 16 |
+
|
| 17 |
+
Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:
|
| 18 |
+
|
| 19 |
+
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
|
| 20 |
+
forums](https://discuss.streamlit.io).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|