Upload with huggingface_hub
Browse files- README.md +6 -6
- app.py +23 -0
- requirements.txt +1 -0
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.3.1
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: gif_maker
|
| 4 |
+
emoji: 🔥
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
sdk_version: 3.3.1
|
| 9 |
+
|
| 10 |
app_file: app.py
|
| 11 |
pinned: false
|
| 12 |
---
|
|
|
|
|
|
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import tempfile
|
| 4 |
+
|
| 5 |
+
def gif_maker(img_files):
|
| 6 |
+
img_array = []
|
| 7 |
+
import os
|
| 8 |
+
for filename in img_files:
|
| 9 |
+
img = cv2.imread(filename.name)
|
| 10 |
+
height, width, _ = img.shape
|
| 11 |
+
size = (width,height)
|
| 12 |
+
img_array.append(img)
|
| 13 |
+
output_file = "test.mp4"
|
| 14 |
+
out = cv2.VideoWriter(output_file,cv2.VideoWriter_fourcc(*'h264'), 15, size)
|
| 15 |
+
for i in range(len(img_array)):
|
| 16 |
+
out.write(img_array[i])
|
| 17 |
+
out.release()
|
| 18 |
+
return output_file
|
| 19 |
+
|
| 20 |
+
demo = gr.Interface(gif_maker, inputs=gr.File(file_count="multiple"), outputs=gr.Video())
|
| 21 |
+
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
opencv-python
|