Kendika commited on
Commit
91b7980
·
verified ·
1 Parent(s): 1a120af

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ # Load model dari Hugging Face hub
6
+ pipe = StableDiffusionPipeline.from_pretrained(
7
+ "izzudd/sd-batik-llava",
8
+ torch_dtype=torch.float16
9
+ ).to("cuda")
10
+
11
+ def generate_image(prompt):
12
+ image = pipe(prompt).images[0]
13
+ return image
14
+
15
+ # Gradio UI
16
+ gr.Interface(
17
+ fn=generate_image,
18
+ inputs=gr.Textbox(label="Masukkan Prompt Batik"),
19
+ outputs=gr.Image(label="Hasil Gambar Batik"),
20
+ title="Batik Generator",
21
+ description="Masukkan deskripsi motif batik, dan AI akan menghasilkan gambarnya!"
22
+ ).launch()