refactor: pass ModelInfo instead of model name string through provider interface
This commit is contained in:
parent
8e3ed7010f
commit
d15444bdb0
8 changed files with 83 additions and 43 deletions
|
|
@ -11,6 +11,7 @@ import httpx
|
|||
from bulkgen.config import TargetConfig
|
||||
from bulkgen.providers import Provider
|
||||
from bulkgen.providers.bfl import BFLClient
|
||||
from bulkgen.providers.models import ModelInfo
|
||||
|
||||
|
||||
def _encode_image_b64(path: Path) -> str:
|
||||
|
|
@ -58,7 +59,7 @@ class ImageProvider(Provider):
|
|||
target_name: str,
|
||||
target_config: TargetConfig,
|
||||
resolved_prompt: str,
|
||||
resolved_model: str,
|
||||
resolved_model: ModelInfo,
|
||||
project_dir: Path,
|
||||
) -> None:
|
||||
output_path = project_dir / target_name
|
||||
|
|
@ -72,14 +73,14 @@ class ImageProvider(Provider):
|
|||
|
||||
if target_config.reference_images:
|
||||
_add_reference_images(
|
||||
inputs, target_config.reference_images, resolved_model, project_dir
|
||||
inputs, target_config.reference_images, resolved_model.name, project_dir
|
||||
)
|
||||
|
||||
for control_name in target_config.control_images:
|
||||
ctrl_path = project_dir / control_name
|
||||
inputs["control_image"] = _encode_image_b64(ctrl_path)
|
||||
|
||||
result = await self._client.generate(resolved_model, inputs)
|
||||
result = await self._client.generate(resolved_model.name, inputs)
|
||||
|
||||
async with httpx.AsyncClient() as http:
|
||||
response = await http.get(result.sample_url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue