Animate_SVG_v2 / app.py
Daniel Gil-U Fuhge
adjust paths
b135ade
raw
history blame
968 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)
targetPath = os.path.join('tempDir', uploaded_file.name[:-4]+"_animated.svg")
with open(path,"wb") as f:
f.write(uploaded_file.getbuffer())
st.success("Saved File")
sys.setrecursionlimit(1500)
animateLogo(path, targetPath)
with open(path, "rb") as file:
st.download_button('Download animated SVG', data=file, file_name=uploaded_file.name[:-4]+"_animated.svg")