File size: 604 Bytes
f70a81f
 
c69b8a1
f70a81f
 
c69b8a1
f70a81f
 
 
c69b8a1
f70a81f
 
 
 
 
 
 
c69b8a1
f70a81f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import DiffusionPipeline

# Load the pre-trained Diffusion model from Hugging Face
pipeline = DiffusionPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V")

def generate_image(prompt):
    image = pipeline(prompt)["sample"][0]
    return image

iface = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Enter your prompt"),
    outputs=gr.Image(type="pil"),
    title="Diffusion Model Image Generator",
    description="Enter a prompt to generate an image using the DiffusionPipeline from Hugging Face."
)

if __name__ == "__main__":
    iface.launch()