instagraph - 将文本输入或URL转换为知识图谱并显示

Created at: 2023-09-13 05:25:09
Language: Python
License: MIT

非编码人员注意:你可以在 instagraph.ai 注册候补名单。

InstaGraph 🌐

你好,冒险的程序员!欢迎来到InstaGraph,这是你用于将文本或URL转换为有见地的知识图谱的首选应用程序。对复杂主题中实体之间的关系感到好奇?将文本馈送到InstaGraph,瞧!精美的知识图谱触手可及。

请参阅此处由InstaGraph生成的示例流程图。

由OpenAI的GPT-3.5提供支持,此Flask应用程序将你的文本转换为色彩鲜艳的图形,从而更轻松地可视化各种实体之间的关系。说得够多了,让我们开始吧!

作者的TL;DR:如果你只是在寻找知识图谱的生成方式,请查看占 main.py 一半的函数调用参数。

📚 目录

特征 🌟

  • 动态文本到图形转换。
  • 颜色编码的图形节点和边。
  • 响应式设计 - 在任何设备上使用它。
  • 超级骗子用户友好!

安装 🛠️

要开始使用,你需要安装 Python 和 pip。

1. 克隆存储库

git clone https://github.com/yoheinakajima/instagraph.git

2. 导航到项目目录

cd instagraph

3. 安装所需的 Python 包

pip install -r requirements.txt

4. 设置你的 OpenAI API 密钥

将 .env.example 更改为 .env

mv .env.example .env

Add your OpenAI API key to .env file:

OPENAI_API_KEY=your-api-key-here
Optional

Add Neo4J username, password and URL in the

*.env
file as well.

NEO4J_USERNAME=
NEO4J_PASSWORD=
NEO4J_URL=

5. Run the Flask app

python main.py

Navigate to

http://localhost:8080
to see your app running.

Run as Container

1. Clone the repository

git clone https://github.com/yoheinakajima/instagraph.git

2. Navigate to the project docker directory

cd instagraph/docker

3.1 Run in Dev mode

docker-compose -f docker-compose-dev.yml up # Add -d flag at the end to run in background/daemon mode.

3.2 Run in Prod - Create the docker image

  • Using the
    gunicorn==21.2.0
    to run the application in production mode
docker-compose -f docker-compose.yml up --build -d

Usage 🎉

Web Interface

  • Open your web browser and navigate to
    http://localhost:8080
    .
  • Type your text or paste a URL in the input box.
  • Click "Submit" and wait for the magic to happen!

API Endpoints

  1. GET Response Data:

    /get_response_data

    • Method:
      POST
    • Data Params:
      {"user_input": "Your text here"}
    • Response: GPT-3.5 processed data
  2. GET Graph Data:

    /get_graph_data

    • Method:
      POST
    • Response: Graph Data
  3. GET History Data:

    /get_graph_history

    • Method:
      GET
    • Response: Graph Data

Contributing 🤝

Best way to chat with me is on Twitter at @yoheinakajima. I usually only code on the weekends or at night, and in pretty small chunks. I have lots ideas on what I want to add here, but obviously this would move faster with everyone. Not sure I can manage Github well given my time constraints, so please reach out if you want to help me run the Github. Now, here are a few ideas on what I think we should add based on comments...

  • Store knowlege graph (thx @tomasonjo! 9/13/23)
  • Pull knowledge graph from storage (thx @tomasonjo! 9/13/23)
  • Show history
  • Ability to combine two graphs
  • Ability to combine 2+ graphs from history
  • Ability to expand on a graph (thx @tomasonjo! 9/13/23)
  • Ability to expand on graph from specific nodes
  • Fuzzy matching of nodes for combining graphs (vector match + LLM confirmation)

There are a lot of "build a chart" tools out there, so instead of doing user account and custom charts, it sounds more fun for me to work on building the largest knowledge graph ever...

Before creating an Issue please refer the ISSUE_TEMPLATE provided.

License 📝

MIT License. See LICENSE for more information.


Enjoy using InstaGraph! 🎉