GDavila commited on
Commit
5a0272f
1 Parent(s): fcd1d25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -92,18 +92,24 @@ if user_image_object is not None:
92
  for ii in [1, 4, 7]:
93
  st.image( img_array[ii] )
94
 
 
95
 
 
 
96
 
97
- '''for this demo prob need to retain image objects bgr_new in an img_array by appending them to that then build them into a gif from the array'''
98
  out = cv2.VideoWriter('outputvideo.mp4',cv2.VideoWriter_fourcc(*'DIVX'), 15, size)
99
  for i in range(len(img_array)):
100
  out.write(img_array[i])
101
  out.release()
102
 
103
- '''HuggingFaces Spaces can create a video vile ephemerally but doesn't actually save one that we can access.
104
- So to show the video/gif we save it as a file then open that file to show it in streamlit'''
105
-
106
-
107
  video_file = open('outputvideo.mp4', 'rb')
108
  video_bytes = video_file.read()
109
- st.video(video_bytes )
 
 
 
 
 
 
 
 
92
  for ii in [1, 4, 7]:
93
  st.image( img_array[ii] )
94
 
95
+ '''for this demo prob need to retain image objects bgr_new in an img_array by appending them to that then build them into a gif from the array'''
96
 
97
+ '''HuggingFaces Spaces can create a video vile ephemerally but doesn't actually save one that we can access.
98
+ So to show the video/gif we save it as a file then open that file to show it in streamlit'''
99
 
100
+ ''' mp4 method
101
  out = cv2.VideoWriter('outputvideo.mp4',cv2.VideoWriter_fourcc(*'DIVX'), 15, size)
102
  for i in range(len(img_array)):
103
  out.write(img_array[i])
104
  out.release()
105
 
 
 
 
 
106
  video_file = open('outputvideo.mp4', 'rb')
107
  video_bytes = video_file.read()
108
+ st.video(video_bytes )
109
+ '''
110
+
111
+ img, *imgs = img_array
112
+ img.save(fp="output_gif.gif", format='GIF', append_images=img_array,
113
+ save_all=True, duration=duration_parameter, loop=loop_parameter)
114
+
115
+ st.image("output_gif.gif")