Views
No views yet
1import os
2from HieraQuery.HieraQueryInference import HieraQuery_Inference
3from HieraQuery.process import MyProcessor
4device = torch.cuda.current_device()
5device = torch.device(device)
6
7model_path=YOUR_MODEL_PATH
8model = HieraQuery_Inference(model_path)
9model.to(torch.bfloat16)
10model.to(device)
11model.eval()
12
13llm_model = os.path.join(model_path, 'llm')
14my_proc = MyProcessor(llm_model)
15
16image_file = "tests/cake.jpg"
17prompt = "add a candle on top of the cake"
18inputs = my_proc.process(image_file=image_file, prompt=prompt, device=device)
19
20result = model.image_gen_generate(inputs, steps=30, seed=42, cfg=5.0, height=512, width=512)[1]
21result.save("result.png")