Changement dans le tab 3, on envoie toujours pour mp4 et on reçoit un zip

This commit is contained in:
François Pelletier 2024-11-11 01:11:18 -05:00
parent 62cd159d0f
commit a0e2067f2b

View file

@ -48,17 +48,13 @@ def app_tab3():
vmargin = st.number_input("Vertical margin:",
value=int(response_format_parameters.get("vmargin")),
step=10)
extension = st.selectbox("Extension:", ["jpg", "pdf", "mp4"])
if extension == "mp4":
fps = st.number_input("FPS:",
value=int(response_format_parameters.get("fps")),
step=1)
stilltime = st.number_input("Still time:",
value=int(response_format_parameters.get("stilltime")),
step=1)
else:
fps = 0
stilltime = 0
extension = "mp4"
fps = st.number_input("FPS:",
value=int(response_format_parameters.get("fps")),
step=1)
stilltime = st.number_input("Still time:",
value=int(response_format_parameters.get("stilltime")),
step=1)
# Envoi
if st.button("Generate post"):
@ -91,14 +87,9 @@ def app_tab3():
file_data = response.content
datef = datetime.datetime.now().strftime("%m-%d-%Y")
if document_specs.extension in ["jpg"]:
extn = "zip"
else:
extn = document_specs.extension
file_name = f"{document_specs.style}-{document_specs.format}-{datef}-output.{extn}"
file_name = f"{document_specs.style}-{document_specs.format}-{datef}-output.zip"
st.download_button('Télécharger', file_data, file_name=file_name)
else:
# If the request is unsuccessful, display the error status code and message
st.error(f"Request failed with status code {response.status_code}: {response.text}")
st.error(f"Request failed with status code {response.status_code}: {response.text}")