harmionestark commited on
Commit
efc7e7b
Β·
verified Β·
1 Parent(s): 7928964

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from diffusers import StableDiffusionPipeline
4
+
5
+ # Load model from Hugging Face
6
+ model_id = "harmionestark/GraveImageAI"
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
+ pipe.to("cuda" if torch.cuda.is_available() else "cpu")
9
+
10
+ # Function to generate images
11
+ def generate_image(prompt):
12
+ image = pipe(prompt).images[0]
13
+ return image
14
+
15
+ # Gradio UI
16
+ with gr.Blocks() as demo:
17
+ gr.Markdown("# πŸš€ GraveImageAI - AI Image Generator")
18
+ with gr.Row():
19
+ prompt = gr.Textbox(label="Enter Prompt", placeholder="A futuristic graveyard under a red sky...")
20
+ generate_button = gr.Button("Generate Image")
21
+ output_image = gr.Image(label="Generated Image")
22
+
23
+ generate_button.click(fn=generate_image, inputs=prompt, outputs=output_image)
24
+
25
+ # Launch app
26
+ demo.launch()