vedant01 commited on
Commit
09cf838
·
verified ·
1 Parent(s): e95e7b4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ # Load the Realistic Vision V6.0 model from Hugging Face
6
+ model_id = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
7
+
8
+ pipe = StableDiffusionPipeline.from_pretrained(
9
+ model_id,
10
+ torch_dtype=torch.float16,
11
+ revision="fp16",
12
+ use_auth_token=True # You may need to generate a HF token and add it here
13
+ ).to("cuda" if torch.cuda.is_available() else "cpu")
14
+
15
+ def generate_image(prompt):
16
+ image = pipe(prompt, guidance_scale=7.5).images[0]
17
+ return image
18
+
19
+ title = "Realistic Indian Man Image Generator"
20
+ description = "Generate realistic images using Realistic Vision V6.0 model. Try prompts like 'realistic portrait of Indian man, 25 years old'."
21
+
22
+ demo = gr.Interface(
23
+ fn=generate_image,
24
+ inputs=gr.Textbox(label="Enter your prompt"),
25
+ outputs=gr.Image(type="pil"),
26
+ title=title,
27
+ description=description,
28
+ theme="default"
29
+ )
30
+
31
+ demo.launch()