mise à jour pour génération de mp4
This commit is contained in:
parent
394669c2c7
commit
0be09de410
1 changed files with 26 additions and 4 deletions
30
main.py
30
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"}
|
||||
|
|
Reference in a new issue