added file size to binding

This commit is contained in:
saloui 2023-07-11 14:56:57 +02:00
parent e91fbe0a25
commit 3922784582
2 changed files with 15 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import importlib
import subprocess
from lollms.config import TypedConfig, InstallOption
from lollms.main_config import LOLLMSConfig
import urllib
__author__ = "parisneo"
__github__ = "https://github.com/ParisNeo/lollms_bindings_zoo"
@ -93,6 +93,19 @@ class LLMBinding:
shutil.rmtree(temp_dir)
def get_file_size(self, url):
# Send a HEAD request to retrieve file metadata
response = urllib.request.urlopen(url)
# Extract the Content-Length header value
file_size = response.headers.get('Content-Length')
# Convert the file size to integer
if file_size:
file_size = int(file_size)
return file_size
def build_model(self):
"""
Build the model.

View File

@ -26,7 +26,7 @@ def get_all_files(path):
setuptools.setup(
name="lollms",
version="2.1.31",
version="2.1.32",
author="Saifeddine ALOUI",
author_email="aloui.saifeddine@gmail.com",
description="A python library for AI personality definition",