1
0
Fork 0
onnx-web/api/onnx_web/convert/client/file.py

30 lines
701 B
Python
Raw Normal View History

from logging import getLogger
from os import path
2023-12-10 00:46:47 +00:00
from typing import Optional
from urllib.parse import urlparse
2023-12-10 00:46:47 +00:00
from ..utils import ConversionContext
from .base import BaseClient
logger = getLogger(__name__)
class FileClient(BaseClient):
protocol = "file://"
def __init__(self, _conversion: ConversionContext):
pass
2023-12-10 00:46:47 +00:00
def download(
self,
conversion: ConversionContext,
2023-12-10 00:46:47 +00:00
_name: str,
uri: str,
format: Optional[str] = None,
dest: Optional[str] = None,
2023-12-10 01:15:28 +00:00
**kwargs,
2023-12-10 00:46:47 +00:00
) -> str:
parts = urlparse(uri)
logger.info("loading model from: %s", parts.path)
return path.join(conversion.model_path, parts.path)