Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
8a599c9
1
Parent(s):
e642c7f
22
Browse files- app.py +8 -29
- requirements.txt +1 -1
- utils/repo_sync.py +7 -0
app.py
CHANGED
|
@@ -4,40 +4,19 @@ import os, random, json, spaces, torch, time, subprocess
|
|
| 4 |
|
| 5 |
import torch
|
| 6 |
# from transformers import AutoProcessor, AutoTokenizer
|
| 7 |
-
|
| 8 |
-
# from longcat_image.pipelines import LongCatImagePipeline
|
| 9 |
|
| 10 |
from utils.image_utils import rescale_image
|
| 11 |
from utils.prompt_utils import polish_prompt
|
| 12 |
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
# else:
|
| 20 |
-
# print("Folder already exists.")
|
| 21 |
-
# MODEL_REPO = "meituan-longcat/LongCat-Image"
|
| 22 |
-
# MAX_SEED = np.iinfo(np.int32).max
|
| 23 |
-
|
| 24 |
-
# text_processor = AutoTokenizer.from_pretrained(
|
| 25 |
-
# MODEL_REPO,
|
| 26 |
-
# subfolder = 'tokenizer'
|
| 27 |
-
# )
|
| 28 |
-
# transformer = LongCatImageTransformer2DModel.from_pretrained(
|
| 29 |
-
# MODEL_REPO ,
|
| 30 |
-
# subfolder = 'transformer',
|
| 31 |
-
# torch_dtype=torch.bfloat16,
|
| 32 |
-
# use_safetensors=True
|
| 33 |
-
# ).to("cuda")
|
| 34 |
-
|
| 35 |
-
# pipe = LongCatImagePipeline.from_pretrained(
|
| 36 |
-
# MODEL_REPO,
|
| 37 |
-
# transformer=transformer,
|
| 38 |
-
# text_processor=text_processor
|
| 39 |
-
# )
|
| 40 |
-
# pipe.to("cuda", torch.bfloat16)
|
| 41 |
|
| 42 |
# def prepare(prompt, is_polish_prompt):
|
| 43 |
# if not is_polish_prompt: return prompt, False
|
|
|
|
| 4 |
|
| 5 |
import torch
|
| 6 |
# from transformers import AutoProcessor, AutoTokenizer
|
| 7 |
+
from diffusers import NewbiePipeline
|
|
|
|
| 8 |
|
| 9 |
from utils.image_utils import rescale_image
|
| 10 |
from utils.prompt_utils import polish_prompt
|
| 11 |
|
| 12 |
+
MODEL_REPO = "NewBie-AI/NewBie-image-Exp0.1"
|
| 13 |
+
MAX_SEED = np.iinfo(np.int32).max
|
| 14 |
|
| 15 |
+
pipe = NewbiePipeline.from_pretrained(
|
| 16 |
+
MODEL_REPO,
|
| 17 |
+
torch_dtype=torch.bfloat16,
|
| 18 |
+
)
|
| 19 |
+
pipe.to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# def prepare(prompt, is_polish_prompt):
|
| 22 |
# if not is_polish_prompt: return prompt, False
|
requirements.txt
CHANGED
|
@@ -3,4 +3,4 @@ torch
|
|
| 3 |
transformers
|
| 4 |
accelerate
|
| 5 |
spaces
|
| 6 |
-
git+https://github.com/
|
|
|
|
| 3 |
transformers
|
| 4 |
accelerate
|
| 5 |
spaces
|
| 6 |
+
git+https://github.com/E-Anlia/diffusers
|
utils/repo_sync.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GIT_DIR = "LongCat-Image"
|
| 2 |
+
# GIT_URL = "https://github.com/yourusername/LongCat-Image.git"
|
| 3 |
+
|
| 4 |
+
# if not os.path.isdir(GIT_DIR):
|
| 5 |
+
# subprocess.run(["git", "clone", GIT_URL])
|
| 6 |
+
# else:
|
| 7 |
+
# print("Folder already exists.")
|