mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
38b3682c3a
* wip * add changeset * sha256 * add changeset * hash * tunneling * add changeset * validate ip address * format * vendor in hash func --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
23 lines
635 B
Python
23 lines
635 B
Python
import cv2
|
|
import gradio as gr
|
|
|
|
def gif_maker(img_files):
|
|
img_array = []
|
|
size = (1, 1)
|
|
for filename in img_files:
|
|
img = cv2.imread(filename.name)
|
|
height, width, _ = img.shape
|
|
size = (width,height)
|
|
img_array.append(img)
|
|
output_file = "test.mp4"
|
|
out = cv2.VideoWriter(output_file,cv2.VideoWriter_fourcc(*'h264'), 15, size) # type: ignore
|
|
for i in range(len(img_array)):
|
|
out.write(img_array[i])
|
|
out.release()
|
|
return output_file
|
|
|
|
demo = gr.Interface(gif_maker, inputs=gr.File(file_count="multiple"), outputs=gr.Video())
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|