Upload folder using huggingface_hub
Browse files- README.md +3 -9
- app.py +17 -0
- files/a.mp4 +0 -0
- files/b.mp4 +0 -0
- files/w1.jpg +0 -0
- files/w2.png +0 -0
- run.ipynb +1 -0
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji: 👀
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: pink
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.1.0
|
8 |
app_file: app.py
|
9 |
-
|
|
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: uptest2
|
|
|
|
|
|
|
|
|
|
|
3 |
app_file: app.py
|
4 |
+
sdk: gradio
|
5 |
+
sdk_version: 5.2.1
|
6 |
---
|
|
|
|
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
a = os.path.join(os.path.dirname(__file__), "files/a.mp4")
|
5 |
+
b = os.path.join(os.path.dirname(__file__), "files/b.mp4")
|
6 |
+
w1 = os.path.join(os.path.dirname(__file__), "files/w1.jpg")
|
7 |
+
w2 = os.path.join(os.path.dirname(__file__), "files/w2.png")
|
8 |
+
|
9 |
+
def generate_video(original_video, watermark):
|
10 |
+
return gr.Video(original_video, watermark=watermark)
|
11 |
+
|
12 |
+
|
13 |
+
demo = gr.Interface(generate_video, [gr.Video(), gr.File()], gr.Video(),
|
14 |
+
examples=[[a, w1], [b, w2]])
|
15 |
+
|
16 |
+
if __name__ == "__main__":
|
17 |
+
demo.launch()
|
files/a.mp4
ADDED
Binary file (130 kB). View file
|
|
files/b.mp4
ADDED
Binary file (261 kB). View file
|
|
files/w1.jpg
ADDED
files/w2.png
ADDED
run.ipynb
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: video_watermark"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('files')\n", "!wget -q -O files/a.mp4 https://github.com/gradio-app/gradio/raw/main/demo/video_watermark/files/a.mp4\n", "!wget -q -O files/b.mp4 https://github.com/gradio-app/gradio/raw/main/demo/video_watermark/files/b.mp4\n", "!wget -q -O files/w1.jpg https://github.com/gradio-app/gradio/raw/main/demo/video_watermark/files/w1.jpg\n", "!wget -q -O files/w2.png https://github.com/gradio-app/gradio/raw/main/demo/video_watermark/files/w2.png"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "\n", "a = os.path.join(os.path.abspath(''), \"files/a.mp4\")\n", "b = os.path.join(os.path.abspath(''), \"files/b.mp4\")\n", "w1 = os.path.join(os.path.abspath(''), \"files/w1.jpg\")\n", "w2 = os.path.join(os.path.abspath(''), \"files/w2.png\")\n", "\n", "def generate_video(original_video, watermark):\n", " return gr.Video(original_video, watermark=watermark)\n", "\n", "\n", "demo = gr.Interface(generate_video, [gr.Video(), gr.File()], gr.Video(),\n", " examples=[[a, w1], [b, w2]])\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|