nateraw / stable-diffusion-videos

Create 🔥 videos with Stable Diffusion by exploring the latent space and morphing between text prompts
Apache License 2.0
4.36k stars 417 forks source link

request python version of file is compatable to run on huggingface spaces gradio sdk #151

Open bugbounted opened 1 year ago

bugbounted commented 1 year ago

Hi Nathan Raw, please make python file compatable to run on huggingface spaces gradio sdk. waiting for your response finest regards

Atomic-Germ commented 1 year ago

I believe the code you're looking for is in the README.MD file:

from stable_diffusion_videos import StableDiffusionWalkPipeline, Interface
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float16,
    revision="fp16",
).to("cuda")

interface = Interface(pipeline)
interface.launch()

or for MacOS on an M1:

from stable_diffusion_videos import StableDiffusionWalkPipeline, Interface
import torch

pipeline = StableDiffusionWalkPipeline.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    torch_dtype=torch.float32,
    revision="fp16",
).to("mps")

interface = Interface(pipeline)
interface.launch()

This gets you:

~> python3 app.py 
Fetching 16 files: 100%|████████████████████████████████████████████████████████████████| 16/16 [00:00<00:00, 17581.57it/s]
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.

and then put that http://127.0.0.1:7860 in the browser:

Screenshot 2023-01-22 at 12 16 14 PM
nateraw commented 1 year ago

Yea you would need to upgrade your space to have a GPU, though, which you can do in the "settings" tab of the space you created. You can see some options here below:

Screen Shot 2023-01-25 at 7 02 05 PM