Daniel Gil-U Fuhge commited on
Commit
0000d05
1 Parent(s): bc86db8

update download

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -7,14 +7,18 @@ from animationPipeline import animateLogo
7
  uploaded_file = st.file_uploader('Please upload your SVG')
8
  if uploaded_file is not None:
9
  file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
10
- st.write(file_details)
11
- if not os.path.exists('tempDir'):
12
- os.mkdir('tempDir')
13
- with open(os.path.join("tempDir",uploaded_file.name),"wb") as f:
14
- f.write(uploaded_file.getbuffer())
15
- st.success("Saved File")
16
- path = os.path.join('tempDir', uploaded_file.name)
17
- sys.setrecursionlimit(1500)
18
- animateLogo(path)
19
- st.download_button('Download animated SVG', os.path.join('tempDir', uploaded_file.name))
 
 
 
 
20
 
 
7
  uploaded_file = st.file_uploader('Please upload your SVG')
8
  if uploaded_file is not None:
9
  file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
10
+ if uploaded_file.type is not 'svg':
11
+ st.write('Please upload an SVG file.')
12
+ else:
13
+ st.write(file_details)
14
+ if not os.path.exists('tempDir'):
15
+ os.mkdir('tempDir')
16
+ path = os.path.join('tempDir', uploaded_file.name)
17
+ with open(path,"wb") as f:
18
+ f.write(uploaded_file.getbuffer())
19
+ st.success("Saved File")
20
+ sys.setrecursionlimit(1500)
21
+ animateLogo(path)
22
+ with open(path, "rb") as file:
23
+ st.download_button('Download animated SVG', filename=uploaded_file.name+"_animated.svg")
24