Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,18 @@
|
|
1 |
-
import
|
2 |
-
from gradio.components import Video
|
3 |
-
import os
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
Args:
|
10 |
-
video_path: The path to the video file to transcode.
|
11 |
-
Returns:
|
12 |
-
The path to the transcoded file.
|
13 |
-
"""
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
if not os.path.exists(output_dir):
|
18 |
-
os.makedirs(output_dir)
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
Input(video_path).output(output_file, format="hls").run()
|
23 |
-
|
24 |
-
# Return the path to the transcoded file.
|
25 |
-
return output_file
|
26 |
-
|
27 |
-
|
28 |
-
video_files = [
|
29 |
-
"/path/to/NEARHUBanimation.mp4",
|
30 |
-
]
|
31 |
|
|
|
32 |
demo = gr.Interface(transcode_video,
|
33 |
gr.components.Video(),
|
34 |
"playable_video",
|
|
|
1 |
+
import huggingface_spaces as hfs
|
|
|
|
|
2 |
|
3 |
+
# Create a space.
|
4 |
+
space = hfs.create_space("my-space")
|
5 |
|
6 |
+
# Install the `ffmpeg-input` module in the space.
|
7 |
+
space.install_package("ffmpeg-input")
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
# Upload the video file to the space.
|
10 |
+
space.upload_file("/path/to/NEARHUBanimation.mp4")
|
|
|
|
|
11 |
|
12 |
+
# Transcode the video file.
|
13 |
+
space.run_script("transcode_video.py")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
# Launch a gradio interface that allows you to play the transcoded video file.
|
16 |
demo = gr.Interface(transcode_video,
|
17 |
gr.components.Video(),
|
18 |
"playable_video",
|