meg-huggingface commited on
Commit
88e4b1c
1 Parent(s): b15d92f

Updating with better examples

Browse files
app.py CHANGED
@@ -1,18 +1,43 @@
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.
@@ -20,7 +45,8 @@ with gr.Blocks() as demo:
20
  Invisible watermarks can help to mark content as authentic.""")
21
 
22
  gr.Markdown()
23
- gr.Markdown("""For more information on watermarking -- what watermarking is, why it's important, and the tools available on Hugging Face -- please check out [our blogpost on AI watermarking](https://huggingface.co/blog/watermarking).""")
 
24
  gr.Interface(generate_video, [gr.Video(), gr.Image(type='filepath', image_mode="RGBA")], gr.Video(),
25
  examples=[[a, w1], [b, w2], [a, w3]])
26
 
 
1
  import gradio as gr
2
  import os
3
 
4
+
5
+ css = """
6
+
7
+ p {
8
+ font-size: 120%;
9
+ }
10
+
11
+ .container {
12
+ height: initial;
13
+ }
14
+
15
+ video {
16
+ max-height: 400px;
17
+ }
18
+ .image-container {
19
+ width: 200px; max-height: 300px;
20
+ margin: auto;
21
+ }
22
+
23
+ img {
24
+ width: auto;
25
+ height: auto;
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")
32
  w2 = os.path.join(os.path.dirname(__file__), "files/hf-logo.png")
33
+ w3 = os.path.join(os.path.dirname(__file__), "files/forest_qr_watermarking.png")
34
 
35
 
36
  def generate_video(original_video, watermark):
37
  return gr.Video(original_video, watermark=watermark)
38
 
39
  # Use RGBA image mode to preserve transparency for png images.
40
+ with gr.Blocks(css=css) as demo:
41
  gr.Markdown("# Watermarking with Gradio: Example")
42
  gr.Markdown("Watermarks can be **visible** or **invisible**.")
43
  gr.Markdown("""They can provide information directly, or provide a link for more information.
 
45
  Invisible watermarks can help to mark content as authentic.""")
46
 
47
  gr.Markdown()
48
+ gr.Markdown("""For more information on watermarking -- what watermarking is, why it's important, and the tools available on Hugging Face --
49
+ please check out [our blogpost on AI watermarking](https://huggingface.co/blog/watermarking).""")
50
  gr.Interface(generate_video, [gr.Video(), gr.Image(type='filepath', image_mode="RGBA")], gr.Video(),
51
  examples=[[a, w1], [b, w2], [a, w3]])
52
 
files/eiffel_tower.mp4 ADDED
Binary file (186 kB). View file
 
files/forest_qr_watermarking.png ADDED