Animate_SVG_v2 / app.py
Daniel Gil-U Fuhge
update postprocessing
a09c67b
raw
history blame
872 Bytes
import streamlit as st
import os
import sys
from animationPipeline import animateLogo
uploaded_file = st.file_uploader('Please upload your SVG')
if uploaded_file is not None:
file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
if 'svg' not in uploaded_file.type:
st.write(uploaded_file.type)
st.write('Please upload an SVG file.')
else:
st.write(file_details)
if not os.path.exists('tempDir'):
os.mkdir('tempDir')
path = os.path.join('tempDir', uploaded_file.name)
with open(path,"wb") as f:
f.write(uploaded_file.getbuffer())
st.success("Saved File")
sys.setrecursionlimit(1500)
animateLogo(path)
with open(path, "rb") as file:
st.download_button('Download animated SVG', data=file, file_name=uploaded_file.name[:-3]+"_animated.svg")