TheWeirdo69 commited on
Commit
73ccafc
·
verified ·
1 Parent(s): d5430e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -26
app.py CHANGED
@@ -1,28 +1,3 @@
1
  import gradio as gr
2
- import torch
3
- from diffusers import StableDiffusionPipeline
4
 
5
- # Load the model
6
- model_path = "TheWeirdo69/TestingNSfw"
7
- pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float32, use_safetensors=True, safety_checker=None)
8
- pipe.to("cuda" if torch.cuda.is_available() else "cpu")
9
-
10
- def generate_image(prompt, height, width):
11
- # Generate the image
12
- with torch.no_grad():
13
- image = pipe(prompt, height=height, width=width, guidance_scale=7.5).images[0]
14
- return image
15
-
16
- # Define the Gradio interface
17
- prompt_input = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
18
- height_input = gr.Slider(minimum=256, maximum=1024, step=8, value=512, label="Height")
19
- width_input = gr.Slider(minimum=256, maximum=1024, step=8, value=512, label="Width")
20
- output_image = gr.Image(type="pil")
21
-
22
- gr.Interface(
23
- fn=generate_image,
24
- inputs=[prompt_input, height_input, width_input],
25
- outputs=output_image,
26
- title="Stable Diffusion Image Generator",
27
- description="Generate images with Stable Diffusion model."
28
- ).launch()
 
1
  import gradio as gr
 
 
2
 
3
+ gr.load("models/TheWeirdo69/TestingNSfw").launch()