Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,10 @@ import glob
|
|
| 19 |
from datetime import datetime
|
| 20 |
from PIL import Image
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
#import os
|
| 23 |
#cache_dir = '/workspace/hf_cache'
|
| 24 |
|
|
@@ -33,44 +37,10 @@ os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
| 33 |
|
| 34 |
# Model configurations
|
| 35 |
MODEL_CONFIGS = {
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
"
|
| 39 |
-
|
| 40 |
-
},
|
| 41 |
-
"Stable Diffusion 3.5": {
|
| 42 |
-
"repo_id": "stabilityai/stable-diffusion-3.5-large",
|
| 43 |
-
"pipeline_class": StableDiffusion3Pipeline,
|
| 44 |
-
# "cache_dir" : cache_dir
|
| 45 |
-
},
|
| 46 |
-
"PixArt": {
|
| 47 |
-
"repo_id": "PixArt-alpha/PixArt-Sigma-XL-2-1024-MS",
|
| 48 |
-
"pipeline_class": PixArtSigmaPipeline,
|
| 49 |
-
# "cache_dir" : cache_dir
|
| 50 |
-
},
|
| 51 |
-
"SANA": {
|
| 52 |
-
"repo_id": "Efficient-Large-Model/Sana_1600M_1024px_BF16_diffusers",
|
| 53 |
-
"pipeline_class": SanaPipeline,
|
| 54 |
-
# "cache_dir" : cache_dir
|
| 55 |
-
},
|
| 56 |
-
"AuraFlow": {
|
| 57 |
-
"repo_id": "fal/AuraFlow",
|
| 58 |
-
"pipeline_class": AuraFlowPipeline,
|
| 59 |
-
# "cache_dir" : cache_dir
|
| 60 |
-
},
|
| 61 |
-
"Kandinsky": {
|
| 62 |
-
"repo_id": "kandinsky-community/kandinsky-3",
|
| 63 |
-
"pipeline_class": Kandinsky3Pipeline,
|
| 64 |
-
#"cache_dir" : cache_dir
|
| 65 |
-
},
|
| 66 |
-
"Hunyuan": {
|
| 67 |
-
"repo_id": "Tencent-Hunyuan/HunyuanDiT-Diffusers",
|
| 68 |
-
"pipeline_class": HunyuanDiTPipeline,
|
| 69 |
-
# "cache_dir" : cache_dir
|
| 70 |
-
},
|
| 71 |
-
"Lumina": {
|
| 72 |
-
"repo_id": "Alpha-VLLM/Lumina-Next-SFT-diffusers",
|
| 73 |
-
"pipeline_class": LuminaText2ImgPipeline,
|
| 74 |
# "cache_dir" : cache_dir
|
| 75 |
}
|
| 76 |
|
|
@@ -227,6 +197,9 @@ def generate_image(
|
|
| 227 |
print(f"Generating image with {model_name}...")
|
| 228 |
# progress(0.3, desc=f"Generating image with {model_name}...")
|
| 229 |
|
|
|
|
|
|
|
|
|
|
| 230 |
image = pipe(
|
| 231 |
prompt=prompt,
|
| 232 |
negative_prompt=negative_prompt,
|
|
|
|
| 19 |
from datetime import datetime
|
| 20 |
from PIL import Image
|
| 21 |
|
| 22 |
+
from onediffusion.diffusion.pipelines.onediffusion import OneDiffusionPipeline
|
| 23 |
+
from onediffusion.models.denoiser.nextdit import NextDiT
|
| 24 |
+
from onediffusion.dataset.utils import get_closest_ratio, ASPECT_RATIO_512
|
| 25 |
+
|
| 26 |
#import os
|
| 27 |
#cache_dir = '/workspace/hf_cache'
|
| 28 |
|
|
|
|
| 37 |
|
| 38 |
# Model configurations
|
| 39 |
MODEL_CONFIGS = {
|
| 40 |
+
|
| 41 |
+
"OneDiffusion": {
|
| 42 |
+
"repo_id": "lehduong/OneDiffusion",
|
| 43 |
+
"pipeline_class": OneDiffusionPipeline,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# "cache_dir" : cache_dir
|
| 45 |
}
|
| 46 |
|
|
|
|
| 197 |
print(f"Generating image with {model_name}...")
|
| 198 |
# progress(0.3, desc=f"Generating image with {model_name}...")
|
| 199 |
|
| 200 |
+
if model_name == "OneDiffusion":
|
| 201 |
+
prompt = "[[text2image]] " + prompt
|
| 202 |
+
|
| 203 |
image = pipe(
|
| 204 |
prompt=prompt,
|
| 205 |
negative_prompt=negative_prompt,
|