"""
- This module defines the User Interface of the app.
- In this project, we use Streamlit.
- But if you want to use any other framework, you need to implement the functions defined here.
"""
import streamlit as st
[docs]
def set_title(title: str):
st.title(title)
[docs]
def display_text(text: str):
st.write(text)
[docs]
def get_text_input(field: str) -> str:
"""
Takes in information, as required by `field`,
from the user as text input, and returns it.
"""
return st.text_input(field)
[docs]
def select_option(field: str, list_of_options: list) -> str:
"""
From the `list_of_options` provided under `field`,
the function returns the selected option.
"""
return st.selectbox(field, list_of_options)
[docs]
def click(field: str) -> bool:
"""
Defines a button for the given `field` and
returns if the button was clicked or not.
"""
return st.button(field)
[docs]
def success(msg: str) -> None:
st.success(msg)
[docs]
def error(msg: str) -> None:
st.error(msg)