callum-canavan
commited on
Commit
•
dba8464
1
Parent(s):
68025a1
Add description
Browse files- app.py +6 -3
- description.txt +5 -0
app.py
CHANGED
@@ -2,7 +2,6 @@ import argparse
|
|
2 |
from pathlib import Path
|
3 |
|
4 |
import gradio as gr
|
5 |
-
print("hello")
|
6 |
from icecream import ic
|
7 |
import torch
|
8 |
from diffusers import DiffusionPipeline
|
@@ -72,9 +71,12 @@ def generate_content(
|
|
72 |
prompts[1],
|
73 |
save_video_path=output_name,
|
74 |
)
|
75 |
-
return output_name, f"sample_{size}.
|
76 |
|
77 |
|
|
|
|
|
|
|
78 |
choices = list(VIEW_MAP_NAMES.keys())
|
79 |
gradio_app = gr.Interface(
|
80 |
fn=generate_content,
|
@@ -87,7 +89,8 @@ gradio_app = gr.Interface(
|
|
87 |
gr.Number(label="Number of diffusion steps", value=75, step=1, minimum=1, maximum=300),
|
88 |
gr.Number(label="Random seed", value=0, step=1, minimum=0, maximum=100000)
|
89 |
],
|
90 |
-
outputs=[gr.Video(label="Illusion"), gr.Image(label="
|
|
|
91 |
)
|
92 |
|
93 |
|
|
|
2 |
from pathlib import Path
|
3 |
|
4 |
import gradio as gr
|
|
|
5 |
from icecream import ic
|
6 |
import torch
|
7 |
from diffusers import DiffusionPipeline
|
|
|
71 |
prompts[1],
|
72 |
save_video_path=output_name,
|
73 |
)
|
74 |
+
return output_name, f"sample_{size}.views.png"
|
75 |
|
76 |
|
77 |
+
with open("description.txt") as f:
|
78 |
+
description = f.read()
|
79 |
+
|
80 |
choices = list(VIEW_MAP_NAMES.keys())
|
81 |
gradio_app = gr.Interface(
|
82 |
fn=generate_content,
|
|
|
89 |
gr.Number(label="Number of diffusion steps", value=75, step=1, minimum=1, maximum=300),
|
90 |
gr.Number(label="Random seed", value=0, step=1, minimum=0, maximum=100000)
|
91 |
],
|
92 |
+
outputs=[gr.Video(label="Illusion"), gr.Image(label="Before and After")],
|
93 |
+
description=description,
|
94 |
)
|
95 |
|
96 |
|
description.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
This application uses diffusion to create **Multi-View Optical Illusions** (or “Visual Anagrams”) - a method developed by [Daniel Geng et al. at the University of Michigan](https://dangeng.github.io/visual_anagrams/). See their original post for good examples and an overview of how it works.
|
2 |
+
|
3 |
+
Their code can be found [here](https://github.com/dangeng/visual_anagrams) (along with tips for choosing prompts) and is used heavily in this app. The method is zero-shot, so this Space uses the pretrained diffusion model [DeepFloyd](https://huggingface.co/DeepFloyd), as in the original paper.
|
4 |
+
|
5 |
+
Please report any issues to Callum Canavan on [Hugging Face](https://huggingface.co/callum-canavan) or [Twitter/X](https://twitter.com/CallumCanavan3).
|