panelforge
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import random
|
4 |
-
|
5 |
from diffusers import DiffusionPipeline
|
6 |
import torch
|
7 |
|
|
|
|
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
-
model_repo_id = "
|
10 |
|
11 |
if torch.cuda.is_available():
|
12 |
torch_dtype = torch.float16
|
@@ -19,7 +22,7 @@ pipe = pipe.to(device)
|
|
19 |
MAX_SEED = np.iinfo(np.int32).max
|
20 |
MAX_IMAGE_SIZE = 1024
|
21 |
|
22 |
-
|
23 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
|
24 |
|
25 |
if randomize_seed:
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import random
|
5 |
+
import spaces #[uncomment to use ZeroGPU]
|
6 |
from diffusers import DiffusionPipeline
|
7 |
import torch
|
8 |
|
9 |
+
token = os.getenv('HUGGINGFACE_TOKEN')
|
10 |
+
|
11 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
12 |
+
model_repo_id = "John6666/sexoholic-real-pony-nsfw-v2-sdxl" #Replace to the model you would like to use
|
13 |
|
14 |
if torch.cuda.is_available():
|
15 |
torch_dtype = torch.float16
|
|
|
22 |
MAX_SEED = np.iinfo(np.int32).max
|
23 |
MAX_IMAGE_SIZE = 1024
|
24 |
|
25 |
+
@spaces.GPU #[uncomment to use ZeroGPU]
|
26 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
|
27 |
|
28 |
if randomize_seed:
|