fabriquedoc-frontend/main.py

60 lines
1.8 KiB
Python
Raw Normal View History

2023-07-05 19:13:28 +00:00
"""
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/>.
"""
2023-01-05 02:23:08 +00:00
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'] = ""
2024-08-24 14:45:06 +00:00
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
2023-01-05 02:23:08 +00:00
st.title("Fabrique à documents")
st.write(f"Endpoint : {st.session_state['fabriquedoc_endpoint']}")
2023-01-05 02:23:08 +00:00
if not st.session_state['logged_in']:
login_form.login_form()
2023-07-05 05:48:59 +00:00
if st.session_state['logged_in']:
tab1, tab2, tab3, tab4 = st.tabs(["Markdown", "Aperçu", "Paramètres", "Images"])
2023-07-05 05:48:59 +00:00
with tab1:
app_tab1.app_tab1()
2023-07-05 05:48:59 +00:00
with tab2:
app_tab2.app_tab2()
2023-07-05 05:48:59 +00:00
with tab3:
app_tab3.app_tab3()
2023-07-05 05:48:59 +00:00
with tab4:
app_tab4.app_tab4()