rahul7star commited on
Commit
adced09
Β·
verified Β·
1 Parent(s): 3c637e3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import DiffusionPipeline
4
+
5
+ # Load the WAN 2.1 T2V Model
6
+ device = "cuda" if torch.cuda.is_available() else "cpu"
7
+ pipe = DiffusionPipeline.from_pretrained("Isi99999/Wan2.1-T2V-1.3B").to(device)
8
+
9
+ def generate_image(prompt):
10
+ """Generates an image from text prompt using WAN 2.1"""
11
+ image = pipe(prompt).images[0]
12
+ return image
13
+
14
+ # Create Gradio UI
15
+ interface = gr.Interface(
16
+ fn=generate_image,
17
+ inputs=gr.Textbox(label="Enter Prompt"),
18
+ outputs=gr.Image(label="Generated Image"),
19
+ title="WAN 2.1 - Text-to-Image Generation",
20
+ description="Generate images from text using WAN 2.1 T2V model."
21
+ )
22
+
23
+ # Launch the app
24
+ interface.launch()