This is the simplest app which contains only one component with a single element.
flask --app examples_py.simple_app.app run
The library is composed of three parts:
- Server -
visuallm.server.Server
- Component -
visuallm.component_base.ComponentBase
- Elements -
visuallm.elements.*
- 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])
- 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
- 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