Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,8 @@ DEFAULT_WIDTH = 1024
|
|
31 |
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {HF_TOKEN}" }
|
32 |
|
33 |
repo_large_path = snapshot_download(repo_id="stabilityai/stable-diffusion-3-medium", revision="refs/pr/26", repo_type="model", ignore_patterns=["*.md", "*..gitattributes"], local_dir="stable-diffusion-3-medium", token=HF_TOKEN)
|
|
|
|
|
34 |
|
35 |
css = '''
|
36 |
.gradio-container{max-width: 560px !important}
|
@@ -54,7 +56,7 @@ repo_customs = {
|
|
54 |
"Realistic": StableDiffusionXLPipeline.from_pretrained("ehristoforu/Visionix-alpha", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False),
|
55 |
"Anime": StableDiffusionXLPipeline.from_pretrained("cagliostrolab/animagine-xl-3.1", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False),
|
56 |
"Pixel": repo_pixel,
|
57 |
-
"Large": StableDiffusion3Pipeline.from_pretrained(repo_large_path, torch_dtype=torch.float16, use_safetensors=True),
|
58 |
}
|
59 |
|
60 |
# Functions
|
@@ -98,8 +100,8 @@ def generate(input=DEFAULT_INPUT, filter_input="", negative_input=DEFAULT_NEGATI
|
|
98 |
steps_set = 15
|
99 |
guidance_set = 1.5
|
100 |
elif model == "Large":
|
101 |
-
steps_set =
|
102 |
-
guidance_set =
|
103 |
else:
|
104 |
steps_set = 25
|
105 |
guidance_set = 7
|
|
|
31 |
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {HF_TOKEN}" }
|
32 |
|
33 |
repo_large_path = snapshot_download(repo_id="stabilityai/stable-diffusion-3-medium", revision="refs/pr/26", repo_type="model", ignore_patterns=["*.md", "*..gitattributes"], local_dir="stable-diffusion-3-medium", token=HF_TOKEN)
|
34 |
+
repo_large_transformer_path = SD3Transformer2DModel.from_pretrained(repo_large_path, torch_dtype=torch.float16)
|
35 |
+
repo_large_transformer = PeftModel.from_pretrained(repo_large_transformer_path, "jasperai/flash-sd3")
|
36 |
|
37 |
css = '''
|
38 |
.gradio-container{max-width: 560px !important}
|
|
|
56 |
"Realistic": StableDiffusionXLPipeline.from_pretrained("ehristoforu/Visionix-alpha", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False),
|
57 |
"Anime": StableDiffusionXLPipeline.from_pretrained("cagliostrolab/animagine-xl-3.1", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False),
|
58 |
"Pixel": repo_pixel,
|
59 |
+
"Large": StableDiffusion3Pipeline.from_pretrained(repo_large_path, transformer=repo_large_transformer, torch_dtype=torch.float16, use_safetensors=True),
|
60 |
}
|
61 |
|
62 |
# Functions
|
|
|
100 |
steps_set = 15
|
101 |
guidance_set = 1.5
|
102 |
elif model == "Large":
|
103 |
+
steps_set = 8
|
104 |
+
guidance_set = 1
|
105 |
else:
|
106 |
steps_set = 25
|
107 |
guidance_set = 7
|