Support FLUX reference images through real edit workflow
This commit is contained in:
1 parent
66e974291d
commit
508a3f4176
5 files changed
+39
-6
No files matched your search
+16
-1
@@ -23,7 +23,22 @@ class ImageTestTests(unittest.TestCase):
|
||||
self.assertEqual(graph['4']['inputs']['image_2'],['22',0])
|
||||
self.assertEqual(graph['6']['inputs']['latent_image'],['4',2])
|
||||
self.assertEqual(graph['21']['inputs']['image'],'reference-1.png')
|
||||
with self.assertRaises(ValueError):workflow('test',p,1,'flux',['reference-1.png'])
|
||||
with self.assertRaises(ValueError):workflow('test',p,1,'unknown',['reference-1.png'])
|
||||
def test_flux_references_feed_both_conditioning_branches(self):
|
||||
p=dict(width=512,height=512,steps=4,guidance=1)
|
||||
for count in (1,4):
|
||||
graph=workflow('synthetic edit',p,42,'flux',[f'reference-{i}.png' for i in range(count)])
|
||||
self.assertEqual(sum(n['class_type']=='ReferenceLatent' for n in graph.values()),count*2)
|
||||
self.assertEqual(graph['10']['inputs']['positive'],[str(23+(count-1)*5),0])
|
||||
self.assertEqual(graph['10']['inputs']['negative'],[str(24+(count-1)*5),0])
|
||||
self.assertEqual(graph['22']['inputs']['vae'],['3',0])
|
||||
self.assertEqual(graph['6']['inputs']['latent_image'],['5',0])
|
||||
with self.assertRaises(ValueError):workflow('test',p,1,'flux',['r.png']*5)
|
||||
def test_reference_capabilities_follow_supported_recipes(self):
|
||||
from profiles import image_capabilities,FLUX_REPO,QWEN_REPO
|
||||
self.assertEqual(image_capabilities(dict(repo=FLUX_REPO,file='Flux.2 Klein-9B_fp16_nsfw.safetensors'))['reference_images'],4)
|
||||
self.assertEqual(image_capabilities(dict(repo=QWEN_REPO,file='model.gguf'))['reference_images'],4)
|
||||
self.assertEqual(image_capabilities(dict(repo='unknown',file='model.safetensors'))['reference_images'],0)
|
||||
def test_reference_validation_enforces_profile_limit_and_signature(self):
|
||||
import base64
|
||||
png='data:image/png;base64,'+base64.b64encode(b'\x89PNG\r\n\x1a\nsynthetic').decode()
|
||||
|
||||
Reference in new issue
Block a user