change path for imports
Browse files- handler.py +34 -15
handler.py
CHANGED
@@ -20,6 +20,13 @@ from torch import autocast
|
|
20 |
# https://huggingface.co/docs/inference-endpoints/guides/custom_handler
|
21 |
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# set device
|
24 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
25 |
|
@@ -29,33 +36,45 @@ if device.type != "cuda":
|
|
29 |
|
30 |
class EndpointHandler:
|
31 |
LORA_PATHS = {
|
32 |
-
"hairdetailer": "
|
33 |
-
"lora_leica": "
|
34 |
-
"epiNoiseoffset_v2": "
|
35 |
-
"MBHU-TT2FRS": "
|
36 |
-
"ShinyOiledSkin_v20": "
|
37 |
-
"polyhedron_new_skin_v1.1":
|
38 |
-
|
39 |
-
"
|
40 |
-
"
|
|
|
41 |
}
|
42 |
|
43 |
TEXTUAL_INVERSION = [
|
44 |
{
|
45 |
-
"weight_name": "
|
46 |
"token": "easynegative",
|
47 |
},
|
48 |
-
{"weight_name": "isatis/kw/embeddings/badhandv4.pt", "token": "badhandv4"},
|
49 |
{
|
50 |
-
"weight_name": "
|
|
|
|
|
|
|
|
|
|
|
51 |
"token": "bad-artist-anime",
|
52 |
},
|
53 |
-
{"weight_name": "
|
54 |
{
|
55 |
-
"weight_name": "
|
56 |
"token": "ng_deepnegative_v1_75t",
|
57 |
},
|
58 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
]
|
60 |
|
61 |
def __init__(self, path="."):
|
|
|
20 |
# https://huggingface.co/docs/inference-endpoints/guides/custom_handler
|
21 |
|
22 |
|
23 |
+
# if local avoid repo url
|
24 |
+
LOCAL = False
|
25 |
+
PREFIX_URL = ""
|
26 |
+
if not LOCAL:
|
27 |
+
PREFIX_URL = "https://huggingface.co/isatis/kw/"
|
28 |
+
|
29 |
+
|
30 |
# set device
|
31 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
32 |
|
|
|
36 |
|
37 |
class EndpointHandler:
|
38 |
LORA_PATHS = {
|
39 |
+
"hairdetailer": PREFIX_URL + "lora/hairdetailer.safetensors",
|
40 |
+
"lora_leica": PREFIX_URL + "lora/lora_leica.safetensors",
|
41 |
+
"epiNoiseoffset_v2": PREFIX_URL + "lora/epiNoiseoffset_v2.safetensors",
|
42 |
+
"MBHU-TT2FRS": PREFIX_URL + "lora/MBHU-TT2FRS.safetensors",
|
43 |
+
"ShinyOiledSkin_v20": PREFIX_URL + "lora/ShinyOiledSkin_v20-LoRA.safetensors",
|
44 |
+
"polyhedron_new_skin_v1.1": PREFIX_URL
|
45 |
+
+ "lora/polyhedron_new_skin_v1.1.safetensors",
|
46 |
+
"detailed_eye-10": PREFIX_URL + "lora/detailed_eye-10.safetensors",
|
47 |
+
"add_detail": PREFIX_URL + "lora/add_detail.safetensors",
|
48 |
+
"MuscleGirl_v1": PREFIX_URL + "lora/MuscleGirl_v1.safetensors",
|
49 |
}
|
50 |
|
51 |
TEXTUAL_INVERSION = [
|
52 |
{
|
53 |
+
"weight_name": PREFIX_URL + "embeddings/EasyNegative.safetensors",
|
54 |
"token": "easynegative",
|
55 |
},
|
|
|
56 |
{
|
57 |
+
"weight_name": PREFIX_URL + "embeddings/EasyNegative.safetensors",
|
58 |
+
"token": "EasyNegative",
|
59 |
+
},
|
60 |
+
{"weight_name": PREFIX_URL + "embeddings/badhandv4.pt", "token": "badhandv4"},
|
61 |
+
{
|
62 |
+
"weight_name": PREFIX_URL + "embeddings/bad-artist-anime.pt",
|
63 |
"token": "bad-artist-anime",
|
64 |
},
|
65 |
+
{"weight_name": PREFIX_URL + "embeddings/NegfeetV2.pt", "token": "NegfeetV2"},
|
66 |
{
|
67 |
+
"weight_name": PREFIX_URL + "embeddings/ng_deepnegative_v1_75t.pt",
|
68 |
"token": "ng_deepnegative_v1_75t",
|
69 |
},
|
70 |
+
{
|
71 |
+
"weight_name": PREFIX_URL + "embeddings/ng_deepnegative_v1_75t.pt",
|
72 |
+
"token": "NG_DeepNegative_V1_75T",
|
73 |
+
},
|
74 |
+
{
|
75 |
+
"weight_name": PREFIX_URL + "embeddings/bad-hands-5.pt",
|
76 |
+
"token": "bad-hands-5",
|
77 |
+
},
|
78 |
]
|
79 |
|
80 |
def __init__(self, path="."):
|