fabriquedoc-frontend/main.py

59 lines
1.8 KiB
Python

"""
Fabrique à documents
Copyright (C) 2023 François Pelletier
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import streamlit as st
import dotenv
import os
import app_tab1
import app_tab2
import app_tab3
import app_tab4
import login_form
if 'fabriquedoc_endpoint' not in st.session_state:
dotenv.load_dotenv()
st.session_state['fabriquedoc_endpoint'] = os.environ.get("FABRIQUEDOC_ENDPOINT",
"http://127.0.0.1:8000")
if 'options' not in st.session_state:
st.session_state['options'] = ""
if 'bearer_token' not in st.session_state:
st.session_state['bearer_token'] = ""
if 'logged_in' not in st.session_state:
st.session_state['logged_in'] = False
st.title("Fabrique à documents")
st.write(f"Endpoint : {st.session_state['fabriquedoc_endpoint']}")
if not st.session_state['logged_in']:
login_form.login_form()
if st.session_state['logged_in']:
tab1, tab2, tab3, tab4 = st.tabs(["Markdown", "Aperçu", "Paramètres", "Images"])
with tab1:
app_tab1.app_tab1()
with tab2:
app_tab2.app_tab2()
with tab3:
app_tab3.app_tab3()
with tab4:
app_tab4.app_tab4()