Spaces:
Sleeping
Sleeping
PseudoTerminal X
commited on
Commit
•
38d6f1a
1
Parent(s):
eaed5f3
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import gradio as gr
|
|
4 |
import spaces
|
5 |
|
6 |
# Load the pre-trained diffusion model
|
7 |
-
pipe = StableDiffusion3Pipeline.from_pretrained('ptx0/sd3-
|
8 |
pipe.to('cuda')
|
9 |
import re
|
10 |
|
@@ -19,13 +19,12 @@ def extract_resolution(resolution_str):
|
|
19 |
|
20 |
# Define the image generation function with adjustable parameters and a progress bar
|
21 |
@spaces.GPU
|
22 |
-
def generate(prompt, guidance_scale,
|
23 |
width, height = extract_resolution(resolution) or (1024, 1024)
|
24 |
return pipe(
|
25 |
prompt,
|
26 |
negative_prompt=negative_prompt,
|
27 |
guidance_scale=guidance_scale,
|
28 |
-
#guidance_rescale=guidance_rescale,
|
29 |
num_inference_steps=num_inference_steps,
|
30 |
width=width, height=height
|
31 |
).images
|
@@ -43,7 +42,6 @@ iface = gr.Interface(
|
|
43 |
inputs=[
|
44 |
gr.Text(label="Enter your prompt"),
|
45 |
gr.Slider(1, 20, step=0.1, label="Guidance Scale", value=9.5),
|
46 |
-
gr.Slider(0, 1, step=0.1, label="Rescale classifier-free guidance", value=0.7),
|
47 |
gr.Slider(1, 50, step=1, label="Number of Inference Steps", value=25),
|
48 |
gr.Radio(["1024x1024", "1152x960", "896x1152"], label="Resolution", value="1152x960"),
|
49 |
gr.Text(value="underexposed, blurry, ugly, washed-out", label="Negative Prompt")
|
|
|
4 |
import spaces
|
5 |
|
6 |
# Load the pre-trained diffusion model
|
7 |
+
pipe = StableDiffusion3Pipeline.from_pretrained('ptx0/sd3-reality-mix', torch_dtype=torch.bfloat16)
|
8 |
pipe.to('cuda')
|
9 |
import re
|
10 |
|
|
|
19 |
|
20 |
# Define the image generation function with adjustable parameters and a progress bar
|
21 |
@spaces.GPU
|
22 |
+
def generate(prompt, guidance_scale, num_inference_steps, resolution, negative_prompt):
|
23 |
width, height = extract_resolution(resolution) or (1024, 1024)
|
24 |
return pipe(
|
25 |
prompt,
|
26 |
negative_prompt=negative_prompt,
|
27 |
guidance_scale=guidance_scale,
|
|
|
28 |
num_inference_steps=num_inference_steps,
|
29 |
width=width, height=height
|
30 |
).images
|
|
|
42 |
inputs=[
|
43 |
gr.Text(label="Enter your prompt"),
|
44 |
gr.Slider(1, 20, step=0.1, label="Guidance Scale", value=9.5),
|
|
|
45 |
gr.Slider(1, 50, step=1, label="Number of Inference Steps", value=25),
|
46 |
gr.Radio(["1024x1024", "1152x960", "896x1152"], label="Resolution", value="1152x960"),
|
47 |
gr.Text(value="underexposed, blurry, ugly, washed-out", label="Negative Prompt")
|