Giter Club home page Giter Club logo

prettygraph's Introduction

prettygraph

prettygraph is a Python-based web application developed by @yoheinakajima to demonstrate a new UI pattern for text-to-knowledge graph generation. This project is a quick hack and not intended to be a robust framework, but a simple UI idea for dynamically highlighting the text input when generating knowledge graphs.

prettygraph image

Overview

The application uses Flask for the backend, rendering templates for the front end, and LiteLLM for generating predictions which transform text inputs into JSON formatted graph data. This data is then visualized using Cytoscape.js. It's important to note that the graph regenerates on every period insertion with real-time updates in the UI, providing an interactive experience.

Features

  • Text-to-Graph Generation: Converts user input text into a knowledge graph.
  • Dynamic UI Updates: Graph updates with each text input that ends with a period.
  • Color-Coded Visualization: Nodes and edges in the graph are color-coded for better visual distinction.

Installation

This project uses Poetry for dependency management. To set up the project:

  1. Clone the repository:

    git clone https://github.com/yoheinakajima/prettygraph
  2. Navigate to the project directory:

    cd prettygraph
  3. Install dependencies using Poetry:

    poetry install
  4. Run the Flask application:

    poetry run python main.py

Configuring Environment Variables

To run this application, you need to set up the OPENAI_API_KEY environment variable. Create a file named .env in the root directory of your project and add the following line:

OPENAI_API_KEY=your_openai_api_key_here

Usage

Once the application is running and the environment variables are set, open your web browser and navigate to http://localhost/. Input text into the editable text box, and watch as the knowledge graph updates with each sentence termination (period).

Future Improvements

  • Improved Tracking: Enhance the logic for tracking nodes and edges through their flow in the text, moving away from simple keyword matching to a more sophisticated relationship mapping.
  • Manual Graph Update: Introduce a manual update button to generate the graph as needed, reducing computational load and API costs.
  • Loading Animation: Add a loading animation during graph generation to improve user experience by indicating processing is underway.
  • Incremental Graph Building: Instead of regenerating the entire graph with each input, modify the existing graph by adding new elements and deduplicating nodes similarly to mindgraph.

Contributing

While prettygraph is not intended to be maintained as a robust framework, contributions are welcome. Feel free to fork the repository and submit pull requests.

License

This project is open-sourced under the MIT License. See the LICENSE file for more details.

Additional Resources

For those interested in exploring more about knowledge graphs:

  • InstaGraph - Web-based tool for generating knowledge graphs. Or for a web UI, try out instagraph.ai - has knowledge graph generation but not the color coded highlights.
  • mindgraph - For generating large knowledge graphs with deduping of nodes using an LLM as new graphs are added.

Disclaimer

This is an experimental project and may not handle all edge cases or inputs effectively.

prettygraph's People

Contributors

yoheinakajima avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.