Spaces:
Running
Running
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 uploaded_file.type is not 'image/svg+xml': | |
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', filename=uploaded_file.name+"_animated.svg") | |