Spaces:
Sleeping
Sleeping
Deepa Shalini commited on
Commit ·
b2aaec1
1
Parent(s): d4baecc
main app shell and overview page
Browse files- .gitignore +5 -0
- app.py +74 -0
- assets/custom.css +8 -0
- pages/overview.py +30 -0
- utils/components.py +39 -0
.gitignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ignore virtual environment
|
| 2 |
+
chartbot/
|
| 3 |
+
|
| 4 |
+
# ignore python cache
|
| 5 |
+
__pycache__/
|
app.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import dash
|
| 2 |
+
from dash import html, _dash_renderer
|
| 3 |
+
import dash_mantine_components as dmc
|
| 4 |
+
import dash_bootstrap_components as dbc
|
| 5 |
+
|
| 6 |
+
_dash_renderer._set_react_version("18.2.0")
|
| 7 |
+
|
| 8 |
+
app = dash.Dash(__name__, use_pages=True, external_stylesheets=[dbc.themes.BOOTSTRAP])
|
| 9 |
+
|
| 10 |
+
header = dmc.Flex(
|
| 11 |
+
[
|
| 12 |
+
dmc.Image(src="http://geneaipilot.thermofisher.com/assets/tfs.png",
|
| 13 |
+
h=35, w=185, className="ps-3 position-absolute top-50 start-0 translate-middle-y"),
|
| 14 |
+
dmc.Anchor("EmPower.AI", size="xl", fw=530,
|
| 15 |
+
href="/", underline="never", c="black",
|
| 16 |
+
style={"margin-left": 210},
|
| 17 |
+
className="position-absolute top-50 start-0 translate-middle-y"),
|
| 18 |
+
],
|
| 19 |
+
direction={"base": "column", "sm": "row"},
|
| 20 |
+
gap={"base": "sm", "sm": "lg"},
|
| 21 |
+
justify={"sm": "center"},
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
left_nav_bar = html.Div(
|
| 25 |
+
[
|
| 26 |
+
dmc.NavLink(
|
| 27 |
+
label="Overview",
|
| 28 |
+
href="/",
|
| 29 |
+
active=True
|
| 30 |
+
),
|
| 31 |
+
dmc.NavLink(
|
| 32 |
+
label="ChaRtBot",
|
| 33 |
+
#leftSection=get_icon(icon="tabler:fingerprint"),
|
| 34 |
+
childrenOffset=28,
|
| 35 |
+
opened=True,
|
| 36 |
+
children=[
|
| 37 |
+
dmc.NavLink(label="English Women's Football Matches (2011 - 2024)", description="Demo data",),
|
| 38 |
+
dmc.NavLink(label="US Presidential Elections (1976-2020)", description="Demo data",),
|
| 39 |
+
dmc.NavLink(label="Space Missions (2000 - 2022)", description="Demo data",),
|
| 40 |
+
dmc.NavLink(label="Amazon Purchases 2021 Sample", description="Demo data",),
|
| 41 |
+
dmc.NavLink(label="Upload your data")
|
| 42 |
+
],
|
| 43 |
+
),
|
| 44 |
+
dmc.NavLink(
|
| 45 |
+
label="Product roadmap"
|
| 46 |
+
),
|
| 47 |
+
dmc.NavLink(
|
| 48 |
+
label="FAQs",
|
| 49 |
+
href="/faqs",
|
| 50 |
+
)
|
| 51 |
+
],
|
| 52 |
+
style={"width": 240, "margin-top": 10, "margin-left": 10, "font-weight": "bold"}
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
app_shell = dmc.AppShell(
|
| 56 |
+
[
|
| 57 |
+
dmc.AppShellHeader(header),
|
| 58 |
+
dmc.AppShellNavbar(left_nav_bar),
|
| 59 |
+
dmc.AppShellMain([dash.page_container]),
|
| 60 |
+
],
|
| 61 |
+
header={"height": 70},
|
| 62 |
+
padding="xl",
|
| 63 |
+
zIndex=1400,
|
| 64 |
+
navbar={
|
| 65 |
+
"width": 260,
|
| 66 |
+
"breakpoint": "sm",
|
| 67 |
+
"collapsed": {"mobile": True},
|
| 68 |
+
},
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
app.layout = dmc.MantineProvider([app_shell])
|
| 72 |
+
|
| 73 |
+
if __name__ == "__main__":
|
| 74 |
+
app.run_server(debug=True)
|
assets/custom.css
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.app-title {
|
| 2 |
+
font-size: 3em;
|
| 3 |
+
font-family: Helvetica;
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
body, a, h1, h2, h3, h4, h5, h6 {
|
| 7 |
+
font-family: Helvetica;
|
| 8 |
+
}
|
pages/overview.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import dash
|
| 2 |
+
from dash import html
|
| 3 |
+
import dash_mantine_components as dmc
|
| 4 |
+
import dash_bootstrap_components as dbc
|
| 5 |
+
|
| 6 |
+
from utils import components
|
| 7 |
+
|
| 8 |
+
dash.register_page(__name__, path='/', name='Overview', order=1)
|
| 9 |
+
|
| 10 |
+
layout = dbc.Container([
|
| 11 |
+
dbc.Col([
|
| 12 |
+
dmc.Title("EmPower.AI - A cost-effective reporting ChaRtBot", className="app-title"),
|
| 13 |
+
html.Hr(),
|
| 14 |
+
dmc.Text("Like a ChatBot, wherein the user can upload a CSV file and enter a prompt, or ask a question.",
|
| 15 |
+
size="xl"),
|
| 16 |
+
dmc.Text("Unlinke a ChatBot which responds in plain text, this ChaRtBot will generate data visualizations (charts) in response to the user's query.",
|
| 17 |
+
size="xl"),
|
| 18 |
+
|
| 19 |
+
html.Br(),
|
| 20 |
+
|
| 21 |
+
dmc.Group([
|
| 22 |
+
components.summary_card("Try the ChaRtBot", "Test the ChaRtBot with popular pre-defined datasets or upload your own .csv or .xlsx data.", isButtonMenu=True),
|
| 23 |
+
|
| 24 |
+
components.summary_card("Roadmap for EmPower.AI", "Check out the product roadmap for EmPower.AI and how it can help Thermo Fisher Scientific Inc."),
|
| 25 |
+
|
| 26 |
+
components.summary_card("FAQs", "Check out the answers to some of the Frequently Asked Questions regarding EmPower.AI."),
|
| 27 |
+
|
| 28 |
+
], justify="center"),
|
| 29 |
+
])
|
| 30 |
+
])
|
utils/components.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import dash_mantine_components as dmc
|
| 2 |
+
|
| 3 |
+
def summary_card(
|
| 4 |
+
title: str,
|
| 5 |
+
description: str,
|
| 6 |
+
isButtonMenu: bool = False
|
| 7 |
+
) -> dmc.Card:
|
| 8 |
+
if isButtonMenu:
|
| 9 |
+
return dmc.Card([
|
| 10 |
+
dmc.CardSection([
|
| 11 |
+
dmc.Text(title, size="xl", fw=500),
|
| 12 |
+
dmc.Divider(variant="solid"),
|
| 13 |
+
dmc.Space(h="sm"),
|
| 14 |
+
dmc.Text(description, size="sm"),
|
| 15 |
+
dmc.Space(h="md"),
|
| 16 |
+
dmc.Menu([
|
| 17 |
+
dmc.MenuTarget(dmc.Button("Get Started", color="#E71316", className="float-end")),
|
| 18 |
+
dmc.MenuDropdown([
|
| 19 |
+
dmc.MenuItem("English Women's Football Matches (2011 - 2024)", href="/chartbot/football"),
|
| 20 |
+
dmc.MenuItem("US Presidential Elections (1976-2020)", href="/chartbot/us-elections"),
|
| 21 |
+
dmc.MenuItem("Space Missions (2000 - 2022)", href="/chartbot/space-missions"),
|
| 22 |
+
dmc.MenuItem("Amazon Purchases 2021 Sample", href="/chartbot/amazon-purchases"),
|
| 23 |
+
dmc.MenuItem("Upload your data", href="/chartbot")
|
| 24 |
+
])
|
| 25 |
+
])
|
| 26 |
+
], style={"margin": 10})
|
| 27 |
+
], withBorder=True, radius="md", w=320)
|
| 28 |
+
|
| 29 |
+
else:
|
| 30 |
+
return dmc.Card([
|
| 31 |
+
dmc.CardSection([
|
| 32 |
+
dmc.Text(title, size="xl", fw=500),
|
| 33 |
+
dmc.Divider(variant="solid"),
|
| 34 |
+
dmc.Space(h="sm"),
|
| 35 |
+
dmc.Text(description, size="sm"),
|
| 36 |
+
dmc.Space(h="md"),
|
| 37 |
+
dmc.Button("Get Started", color="#E71316", className="float-end")
|
| 38 |
+
], style={"margin": 10})
|
| 39 |
+
], withBorder=True, radius="md", w=320)
|