Spaces:
Runtime error
Runtime error
Commit
·
716a0b4
1
Parent(s):
eee3c18
init florence2 in global
Browse files
app.py
CHANGED
@@ -250,7 +250,7 @@ loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
|
|
250 |
|
251 |
florence2modelloader = NODE_CLASS_MAPPINGS["Florence2ModelLoader"]()
|
252 |
florence2run = NODE_CLASS_MAPPINGS["Florence2Run"]()
|
253 |
-
|
254 |
|
255 |
|
256 |
|
@@ -343,19 +343,16 @@ model_management.load_models_gpu([
|
|
343 |
])
|
344 |
print("model_management.load_models_gpu(model_loaders) done")
|
345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
@spaces.GPU(duration=60)
|
348 |
def generate_image(model_image, hairstyle_template_image):
|
349 |
-
global florence2modelloader_204 # 声明使用全局变量
|
350 |
-
if florence2modelloader_204 is None:
|
351 |
-
florence2modelloader_204 = florence2modelloader.loadmodel(
|
352 |
-
model="Florence-2-base",
|
353 |
-
precision="fp16",
|
354 |
-
attention="sdpa",
|
355 |
-
convert_to_safetensors=False,
|
356 |
-
)
|
357 |
-
print("load done: Florence-2-base")
|
358 |
-
|
359 |
with torch.inference_mode():
|
360 |
cliptextencode_52 = cliptextencode.encode(
|
361 |
text="multiple_hands, multiple_legs, multiple_girls\nlow quality, blurry, out of focus, distorted, unrealistic, extra limbs, missing limbs, deformed hands, deformed fingers, extra fingers, long neck, unnatural face, bad anatomy, bad proportions, poorly drawn face, poorly drawn eyes, asymmetrical eyes, extra eyes, extra head, floating objects, watermark, text, logo, jpeg artifacts, overexposed, underexposed, harsh lighting, bad posture, strange angles, unnatural expressions, oversaturated colors, messy hair, unrealistic skin texture, wrinkles inappropriately placed, incorrect shading, pixelation, complex background, busy background, detailed background, crowded scene, clutter, messy elements, unnecessary objects, overlapping objects, intricate patterns, vibrant colors, high contrast, graffiti, shadows, reflections, multiple layers, unrealistic lighting, overexposed areas.",
|
|
|
250 |
|
251 |
florence2modelloader = NODE_CLASS_MAPPINGS["Florence2ModelLoader"]()
|
252 |
florence2run = NODE_CLASS_MAPPINGS["Florence2Run"]()
|
253 |
+
|
254 |
|
255 |
|
256 |
|
|
|
343 |
])
|
344 |
print("model_management.load_models_gpu(model_loaders) done")
|
345 |
|
346 |
+
florence2modelloader_204 = florence2modelloader.loadmodel(
|
347 |
+
model="Florence-2-base",
|
348 |
+
precision="fp16",
|
349 |
+
attention="sdpa",
|
350 |
+
convert_to_safetensors=False,
|
351 |
+
)
|
352 |
+
print("load done: Florence-2-base")
|
353 |
|
354 |
@spaces.GPU(duration=60)
|
355 |
def generate_image(model_image, hairstyle_template_image):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
with torch.inference_mode():
|
357 |
cliptextencode_52 = cliptextencode.encode(
|
358 |
text="multiple_hands, multiple_legs, multiple_girls\nlow quality, blurry, out of focus, distorted, unrealistic, extra limbs, missing limbs, deformed hands, deformed fingers, extra fingers, long neck, unnatural face, bad anatomy, bad proportions, poorly drawn face, poorly drawn eyes, asymmetrical eyes, extra eyes, extra head, floating objects, watermark, text, logo, jpeg artifacts, overexposed, underexposed, harsh lighting, bad posture, strange angles, unnatural expressions, oversaturated colors, messy hair, unrealistic skin texture, wrinkles inappropriately placed, incorrect shading, pixelation, complex background, busy background, detailed background, crowded scene, clutter, messy elements, unnecessary objects, overlapping objects, intricate patterns, vibrant colors, high contrast, graffiti, shadows, reflections, multiple layers, unrealistic lighting, overexposed areas.",
|