File size: 590 Bytes
5244c19
3b213f1
 
 
5244c19
 
3b213f1
 
 
 
 
 
526b755
 
3b213f1
 
 
526b755
3b213f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline


def get_stable_diffusion_random_image(prompt):
    model_id = "CompVis/stable-diffusion-v1-4"
    device = "cuda"
    pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
    pipe = pipe.to(device)
    with autocast("cuda"):
        image = pipe(prompt, guidance_scale=7.5)["sample"][0]
        print(image)
        return image


iface = gr.Interface(fn=get_stable_diffusion_random_image, inputs=["text", "audio"], outputs="video")
iface.launch(share=True)