From 0be09de41098685e7ce5b0b186d3eabca7c67a96 Mon Sep 17 00:00:00 2001 From: Francois Pelletier Date: Sun, 12 Feb 2023 20:44:50 -0500 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=20pour=20g=C3=A9n=C3=A9rat?= =?UTF-8?q?ion=20de=20mp4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index c92cc70..60eda23 100644 --- a/main.py +++ b/main.py @@ -17,9 +17,12 @@ class DocumentSpecs(BaseModel): fontsize: int paperwidth: int paperheight: int + ratio: int margin: int vmargin: int extension: str + fps: int + stilltime: int if 'options' not in st.session_state: @@ -37,7 +40,8 @@ with tab1: options={"number": True}) - content = st.text_area("Enter Markdown text to send:", "# Titre\n## sous-titre\nContenu\n> Citation\n", + content = st.text_area("Enter Markdown text to send:", + "# Ceci est un titre\n## Ceci est un sous-titre\n\nCeci est un paragraphe\n\n## Ceci est un autre sous-titre\n\n> Ceci est du code\n\nCeci est un emoji :heart_eyes:\n\n::: {.center}\nCeci est centré\n:::", height=450, key='markdown') st.button("Formater le texte", on_click=button1_callback) @@ -58,7 +62,8 @@ with tab3: selected_format = st.selectbox("Select a format:", formats) # Autres paramètres - response_format_parameters = requests.get(f"{fabriquedoc_endpoint}/format_parameters/{selected_style}/{selected_format}") + response_format_parameters = requests.get( + f"{fabriquedoc_endpoint}/format_parameters/{selected_style}/{selected_format}") format_parameters = response_format_parameters.json() st.write(format_parameters) linkcolor = st.text_input("Link color:", @@ -79,13 +84,27 @@ with tab3: paperheight = st.number_input("Paper height:", value=int(format_parameters.get("paperheight")), step=30) + ratio = st.number_input("Ratio:", + value=int(format_parameters.get("ratio")), + step=10) margin = st.number_input("Margin:", value=int(format_parameters.get("margin")), step=10) vmargin = st.number_input("Vertical margin:", value=int(format_parameters.get("vmargin")), step=10) - extension = st.selectbox("Extension:", ["png", "jpg", "pdf"]) + extension = st.selectbox("Extension:", ["png", "jpg", "pdf", "mp4"]) + if extension == "mp4": + fps = st.number_input("FPS:", + value=int(format_parameters.get("fps")), + step=1) + stilltime = st.number_input("Still time:", + value=int(format_parameters.get("stilltime")), + step=1) + else: + fps = 0 + stilltime = 0 + # Envoi if st.button("Generate post"): document_specs = DocumentSpecs( @@ -98,9 +117,12 @@ with tab3: fontsize=fontsize, paperwidth=paperwidth, paperheight=paperheight, + ratio=ratio, margin=margin, vmargin=vmargin, - extension=extension + extension=extension, + fps=fps, + stilltime=stilltime ) headers = {"Content-Type": "application/json"}