Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,30 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
a = os.path.join(os.path.dirname(__file__), "files/
|
5 |
-
b = os.path.join(os.path.dirname(__file__), "files/
|
6 |
-
w1 = os.path.join(os.path.dirname(__file__), "files/
|
7 |
w2 = os.path.join(os.path.dirname(__file__), "files/hf-logo.png")
|
|
|
8 |
|
9 |
|
10 |
def generate_video(original_video, watermark):
|
11 |
return gr.Video(original_video, watermark=watermark)
|
12 |
|
13 |
# Use RGBA image mode to preserve transparency for png images.
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
if __name__ == "__main__":
|
18 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
+
a = os.path.join(os.path.dirname(__file__), "files/barkley_balloon.mp4")
|
5 |
+
b = os.path.join(os.path.dirname(__file__), "files/convert-to-gradio-sd.mp4")
|
6 |
+
w1 = os.path.join(os.path.dirname(__file__), "files/AI_generated.png")
|
7 |
w2 = os.path.join(os.path.dirname(__file__), "files/hf-logo.png")
|
8 |
+
w3 = os.path.join(os.path.dirname(__file__), "files/watermark_qr_code.png")
|
9 |
|
10 |
|
11 |
def generate_video(original_video, watermark):
|
12 |
return gr.Video(original_video, watermark=watermark)
|
13 |
|
14 |
# Use RGBA image mode to preserve transparency for png images.
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
gr.Markdown("# Watermarking with Gradio: Example")
|
17 |
+
gr.Markdown("Watermarks can be **visible** or **invisible**.")
|
18 |
+
gr.Markdown("""They can provide information directly, or provide a link for more information.
|
19 |
+
Visible watermarks can help to disclose when content is AI-generated, so viewers know it's synthetic.
|
20 |
+
Invisible watermarks can help to mark content as authentic.""")
|
21 |
+
|
22 |
+
gr.Markdown()
|
23 |
+
gr.Markdown("""For more information on watermarking --
|
24 |
+
what watermarking is, why it's important, and the tools available on HF中国镜像站 --
|
25 |
+
please check out [our blogpost on AI watermarking](https://huggingface.co/blog/watermarking).""")
|
26 |
+
gr.Interface(generate_video, [gr.Video(), gr.Image(type='filepath', image_mode="RGBA")], gr.Video(),
|
27 |
+
examples=[[a, w1], [b, w2], [a, w3]])
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
demo.launch()
|