1
0
Fork 0

fix type of client instance

This commit is contained in:
Sean Sube 2023-12-09 23:40:47 -06:00
parent 419b2811ef
commit 50db19922a
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 10 additions and 8 deletions

View File

@ -1,17 +1,18 @@
from typing import Callable, Dict, Optional
from logging import getLogger
from os import path
from ..utils import ConversionContext
from .base import BaseClient
from .civitai import CivitaiClient
from .file import FileClient
from .http import HttpClient
from .huggingface import HuggingfaceClient
from ..utils import ConversionContext
from typing import Dict, Optional
from logging import getLogger
from os import path
logger = getLogger(__name__)
model_sources: Dict[str, BaseClient] = {
model_sources: Dict[str, Callable[[], BaseClient]] = {
CivitaiClient.protocol: CivitaiClient,
FileClient.protocol: FileClient,
HttpClient.insecure_protocol: HttpClient,
@ -44,9 +45,10 @@ def fetch_model(
for proto, client_type in model_sources.items():
if source.startswith(proto):
# TODO: fix type of client_type
client: BaseClient = client_type()
return client.download(conversion, name, source, format=format, dest=dest, **kwargs)
client = client_type()
return client.download(
conversion, name, source, format=format, dest=dest, **kwargs
)
logger.warning("unknown model protocol, using path as provided: %s", source)
return source