Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 2.11 KB

README.md

File metadata and controls

70 lines (50 loc) · 2.11 KB

Simple Example

This is the simplest app which contains only one component with a single element.

Run command

flask --app examples_py.simple_app.app run

Module System

The library is composed of three parts:

  1. Server - visuallm.server.Server
  2. Component - visuallm.component_base.ComponentBase
  3. Elements - visuallm.elements.*

Expected Workflow

  1. Create a class inheriting from visuallm.component_base.ComponentBase. In __init__ you should:
  • create all the elements from which the page should be composed and add them to the component
# ./simple_component.py lines 1-15
from visuallm.component_base import ComponentBase
from visuallm.elements import MainHeadingElement, PlainTextElement


class SimpleComponent(ComponentBase):
    def __init__(self):
        super().__init__(name="simple_component", title="Simple Component")
        main_heading_element = MainHeadingElement(content="Really Easy Component")
        self.text_element = PlainTextElement(
            content="""
                Some really interesting text that isn't formatted in any way, it is
                just a plain simple text
            """
        )
        self.add_elements([main_heading_element, self.text_element])
  1. Initialize llm_generation_server.server.Server and pass in the initialized components
# ./app.py
from visuallm.server import Server

from .simple_component import SimpleComponent

server = Server(__name__, [SimpleComponent()])
app = server.app
  1. Standard method to run the flask application, e.g. for the example provided above, it would be:
flask --app examples_py.simple_app.app run

Screenshot

really_simple_page