File: streamlite_app.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (29 lines) | stat: -rw-r--r-- 623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import sys

import streamlit as st

from tabs.policies import plot_policy_adoptions
from tabs.stats import draw_plots

current_dir = os.path.dirname(__file__)
common = os.path.join(current_dir, "..")
assert os.path.exists(common)
sys.path.append(common)

from charting.log_parser.collect_data import get_ais_data  # noqa: E402, need to inject common dir before import


def setup_layout():
    st.set_page_config(layout="wide")


setup_layout()

plots_tab, policies_tab = st.tabs(["Stats", "Policies"])

with plots_tab:
    draw_plots(get_ais_data())

with policies_tab:
    plot_policy_adoptions(get_ais_data())