Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
-
import gradio
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
],
|
14 |
-
title="REST API with Gradio and Huggingface Spaces",
|
15 |
-
description="This is a demo of how to build an AI powered REST API with Gradio and Huggingface Spaces – for free! Based on [this article](https://www.tomsoderlund.com/ai/building-ai-powered-rest-api). See the **Use via API** link at the bottom of this page.",
|
16 |
-
article="© Tom Söderlund 2022"
|
17 |
)
|
18 |
-
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
|
3 |
+
def display_video(video_file):
|
4 |
+
"""
|
5 |
+
Displays the uploaded video using Gradio Video component.
|
6 |
+
Args:
|
7 |
+
video_file (gradio.File): The uploaded video file object.
|
8 |
+
"""
|
9 |
+
if video_file:
|
10 |
+
return video_file.name # Return the video filename for display
|
11 |
|
12 |
+
# Create Gradio interface with UploadButton and Video components
|
13 |
+
interface = gr.Interface(
|
14 |
+
fn=display_video,
|
15 |
+
inputs=gr.Upload(name="Upload Video", file_types=["video"]),
|
16 |
+
outputs=gr.Video(label="Uploaded Video"),
|
17 |
+
title="Video Uploader",
|
18 |
+
description="Upload a video file to display it here."
|
|
|
|
|
|
|
|
|
19 |
)
|
20 |
+
|
21 |
+
# Launch the Gradio interface
|
22 |
+
interface.launch()
|