Spaces:
Runtime error
Runtime error
Commit
·
0355c5b
1
Parent(s):
7fca39d
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5):
|
|
|
1 |
+
import torch
|
2 |
+
from torch import autocast
|
3 |
+
from diffusers import StableDiffusionPipeline, DDIMScheduler
|
4 |
+
from IPython.display import display
|
5 |
+
|
6 |
+
model_path = "../" # If you want to use previously trained model saved in gdrive, replace this with the full path of model in gdrive
|
7 |
+
|
8 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_path, safety_checker=None, torch_dtype=torch.float16).to("cuda")
|
9 |
+
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
|
10 |
+
pipe.enable_xformers_memory_efficient_attention()
|
11 |
+
g_cuda = None
|
12 |
+
|
13 |
import gradio as gr
|
14 |
|
15 |
def inference(prompt, negative_prompt, num_samples, height=512, width=512, num_inference_steps=50, guidance_scale=7.5):
|