vedant01's picture
Create app.py
09cf838 verified
raw
history blame contribute delete
942 Bytes
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
# Load the Realistic Vision V6.0 model from Hugging Face
model_id = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
pipe = StableDiffusionPipeline.from_pretrained(
model_id,
torch_dtype=torch.float16,
revision="fp16",
use_auth_token=True # You may need to generate a HF token and add it here
).to("cuda" if torch.cuda.is_available() else "cpu")
def generate_image(prompt):
image = pipe(prompt, guidance_scale=7.5).images[0]
return image
title = "Realistic Indian Man Image Generator"
description = "Generate realistic images using Realistic Vision V6.0 model. Try prompts like 'realistic portrait of Indian man, 25 years old'."
demo = gr.Interface(
fn=generate_image,
inputs=gr.Textbox(label="Enter your prompt"),
outputs=gr.Image(type="pil"),
title=title,
description=description,
theme="default"
)
demo.launch()