diff --git a/frontend/app_tab3.py b/frontend/app_tab3.py index 13e5c26..fcdee86 100644 --- a/frontend/app_tab3.py +++ b/frontend/app_tab3.py @@ -29,15 +29,15 @@ def app_tab3(): f"{st.session_state['fabriquedoc_endpoint']}/format_parameters/{selected_style}/{selected_format}/", headers=http_headers).json() # Création des champs de saisie pour les différents paramètres - linkcolor = st.text_input("Couleur des liens:", value=response_format_parameters.get("linkcolor")) - pdfengine = st.text_input("Moteur PDF:", value=response_format_parameters.get("pdfengine")) - fontsize = st.number_input("Taille de la police:", value=int(response_format_parameters.get("fontsize")), step=1) - paperwidth = st.number_input("Largeur du papier:", value=int(response_format_parameters.get("paperwidth")), step=30) - paperheight = st.number_input("Hauteur du papier:", value=int(response_format_parameters.get("paperheight")), step=30) - margin = st.number_input("Marge:", value=int(response_format_parameters.get("margin")), step=10) - vmargin = st.number_input("Marge verticale:", value=int(response_format_parameters.get("vmargin")), step=10) - fps = st.number_input("Images par seconde:", value=int(response_format_parameters.get("fps")), step=1) - stilltime = st.number_input("Temps d'arrêt:", value=int(response_format_parameters.get("stilltime")), step=1) + linkcolor = st.text_input("Couleur des liens:", value=response_format_parameters.get("linkcolor", "")) + pdfengine = st.text_input("Moteur PDF:", value=response_format_parameters.get("pdfengine", "")) + fontsize = st.number_input("Taille de la police:", value=int(response_format_parameters.get("fontsize", 0)), step=1) + paperwidth = st.number_input("Largeur du papier:", value=int(response_format_parameters.get("paperwidth", 0)), step=30) + paperheight = st.number_input("Hauteur du papier:", value=int(response_format_parameters.get("paperheight", 0)), step=30) + margin = st.number_input("Marge:", value=int(response_format_parameters.get("margin", 0)), step=10) + vmargin = st.number_input("Marge verticale:", value=int(response_format_parameters.get("vmargin", 0)), step=10) + fps = st.number_input("Images par seconde:", value=int(response_format_parameters.get("fps", 0)), step=1) + stilltime = st.number_input("Temps d'arrêt:", value=int(response_format_parameters.get("stilltime", 0)), step=1) # Création d'un bouton pour générer le document if st.button("Générer le document"): @@ -47,7 +47,7 @@ def app_tab3(): style=selected_style, linkcolor=linkcolor, pdfengine=pdfengine, - content=st.session_state['content'], + content=st.session_state['markdown'], fontsize=fontsize, paperwidth=paperwidth, paperheight=paperheight, diff --git a/frontend/app_tab4.py b/frontend/app_tab4.py index 4ad6e83..349d025 100644 --- a/frontend/app_tab4.py +++ b/frontend/app_tab4.py @@ -15,15 +15,25 @@ def app_tab4(): # Récupération de la liste des images depuis le serveur response = requests.get(f"{st.session_state['fabriquedoc_endpoint']}/images/", headers=http_headers) - images = response.json()["images"] - - # Création d'un menu déroulant pour sélectionner une image - selected_image = st.selectbox("Choisis une image:", images) - - # Récupération et affichage de l'image sélectionnée - image_response = requests.get(f"{st.session_state['fabriquedoc_endpoint']}/images/{selected_image}", headers=http_headers) - image_data = image_response.content - st.image(image_data) + images = [] + if response.status_code == 200: + images = response.json().get("images", []) + else: + st.error(f"Erreur lors de la récupération des images: {response.status_code} - {response.text}") + + if images: + # Création d'un menu déroulant pour sélectionner une image + selected_image = st.selectbox("Choisis une image:", images) + + # Récupération et affichage de l'image sélectionnée + image_response = requests.get(f"{st.session_state['fabriquedoc_endpoint']}/images/{selected_image}", headers=http_headers) + if image_response.status_code == 200: + image_data = image_response.content + st.image(image_data) + else: + st.error(f"Erreur lors de la récupération de l'image: {image_response.status_code} - {image_response.text}") + else: + st.info("Aucune image disponible.") # Section pour envoyer une nouvelle image st.write("Envoyer une image")