Spaces:
Running
Running
meg-huggingface
commited on
Commit
·
a87a1d9
1
Parent(s):
99053e9
Updating UI
Browse files
app.py
CHANGED
|
@@ -6,6 +6,10 @@ p {
|
|
| 6 |
font-size: 120%;
|
| 7 |
}
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
.container {
|
| 10 |
height: initial;
|
| 11 |
}
|
|
@@ -26,6 +30,18 @@ img {
|
|
| 26 |
}
|
| 27 |
"""
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
a = os.path.join(os.path.dirname(__file__), "files/barkley_balloon.mp4")
|
| 30 |
b = os.path.join(os.path.dirname(__file__), "files/eiffel_tower.mp4")
|
| 31 |
w1 = os.path.join(os.path.dirname(__file__), "files/AI_generated.png")
|
|
@@ -38,17 +54,35 @@ def generate_video(original_video, watermark):
|
|
| 38 |
|
| 39 |
# Use RGBA image mode to preserve transparency for png images.
|
| 40 |
with gr.Blocks(css=css) as demo:
|
| 41 |
-
gr.
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
gr.Interface(generate_video, [gr.Video(), gr.Image(type='filepath', image_mode=None)], gr.Video(),
|
| 51 |
-
|
| 52 |
|
| 53 |
if __name__ == "__main__":
|
| 54 |
demo.launch()
|
|
|
|
| 6 |
font-size: 120%;
|
| 7 |
}
|
| 8 |
|
| 9 |
+
li {
|
| 10 |
+
font-size: 110%;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
.container {
|
| 14 |
height: initial;
|
| 15 |
}
|
|
|
|
| 30 |
}
|
| 31 |
"""
|
| 32 |
|
| 33 |
+
# Optional CSS stuff for the header example image:
|
| 34 |
+
#example {
|
| 35 |
+
# width: 80%;
|
| 36 |
+
# height: 60%
|
| 37 |
+
#}
|
| 38 |
+
|
| 39 |
+
#example img {
|
| 40 |
+
# width: 80%;
|
| 41 |
+
# height: 80%
|
| 42 |
+
#}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
a = os.path.join(os.path.dirname(__file__), "files/barkley_balloon.mp4")
|
| 46 |
b = os.path.join(os.path.dirname(__file__), "files/eiffel_tower.mp4")
|
| 47 |
w1 = os.path.join(os.path.dirname(__file__), "files/AI_generated.png")
|
|
|
|
| 54 |
|
| 55 |
# Use RGBA image mode to preserve transparency for png images.
|
| 56 |
with gr.Blocks(css=css) as demo:
|
| 57 |
+
with gr.Row():
|
| 58 |
+
with gr.Column():
|
| 59 |
+
gr.Markdown("# 🤗 Watermarking with Gradio: Example")
|
| 60 |
+
gr.Markdown("Watermarks can be **visible** or **invisible**.")
|
| 61 |
+
gr.Markdown("""They can provide information directly, or provide a link for more information.
|
| 62 |
+
- Visible watermarks can help to disclose when content is AI-generated, so viewers know it's synthetic.
|
| 63 |
+
- Invisible watermarks can help to mark content as authentic.""")
|
| 64 |
+
gr.Markdown()
|
| 65 |
+
gr.Markdown()
|
| 66 |
+
gr.Markdown("""For more information on watermarking -- what watermarking is, why it's important,
|
| 67 |
+
and the tools available on Hugging Face -- please check out [our blogpost on AI watermarking](https://huggingface.co/blog/watermarking).""")
|
| 68 |
+
gr.Markdown()
|
| 69 |
+
gr.Markdown("## Try it out below!")
|
| 70 |
+
with gr.Column():
|
| 71 |
+
with gr.Column():
|
| 72 |
+
gr.Image('files/watermark_example.png', visible=False)
|
| 73 |
+
with gr.Column():
|
| 74 |
+
gr.Image('files/watermark_example.png', show_label=False, show_download_button=False, elem_id='example', container=False, interactive=False)
|
| 75 |
+
gr.Markdown('**Code:**')
|
| 76 |
+
gr.Code('import gradio as gr\n\nwatermarked_video = gr.Video(original_video_file, watermark=watermark_file)', lines=3)
|
| 77 |
+
with gr.Column():
|
| 78 |
+
gr.Image('files/watermark_example.png', visible=False)
|
| 79 |
+
with gr.Row():
|
| 80 |
+
with gr.Column():
|
| 81 |
+
gr.Markdown("**Inputs**: Video and watermark file")
|
| 82 |
+
with gr.Column():
|
| 83 |
+
gr.Markdown("**Output**: Watermarked video")
|
| 84 |
gr.Interface(generate_video, [gr.Video(), gr.Image(type='filepath', image_mode=None)], gr.Video(),
|
| 85 |
+
examples=[[a, w1], [b, w2], [a, w3], [b, w4]])
|
| 86 |
|
| 87 |
if __name__ == "__main__":
|
| 88 |
demo.launch()
|