Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,20 +113,20 @@ class Bergamot:
|
|
| 113 |
# dry_run (bool, optional, defaults to False) — If True, perform a dry run without actually downloading the file. Returns a DryRunFileInfo object containing information about what would be downloaded.
|
| 114 |
local_path = hf_hub_download(repo_id=self.repo_id, subfolder=self.model_name, filename=file_path, local_dir=self.subfolder)
|
| 115 |
print(f"Downloaded to: {local_path}") # Downloaded to: deen/base/deen/config.yml
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
except Exception as downloaderror:
|
| 131 |
response, message_text = str(downloaderror), f"Error downloading {self.model_name}: {downloaderror}."
|
| 132 |
print(downloaderror)
|
|
|
|
| 113 |
# dry_run (bool, optional, defaults to False) — If True, perform a dry run without actually downloading the file. Returns a DryRunFileInfo object containing information about what would be downloaded.
|
| 114 |
local_path = hf_hub_download(repo_id=self.repo_id, subfolder=self.model_name, filename=file_path, local_dir=self.subfolder)
|
| 115 |
print(f"Downloaded to: {local_path}") # Downloaded to: deen/base/deen/config.yml
|
| 116 |
+
## Check if model/localfolder in repo files, add to set if exists
|
| 117 |
+
modelcheck = [i for i in all_files if self.model_name in i]
|
| 118 |
+
print('Modelcheck', modelcheck)
|
| 119 |
+
if modelcheck:
|
| 120 |
+
print('Add to set after modelcheck', modelcheck)
|
| 121 |
+
self.installed_pairs.add(self.localfolder)
|
| 122 |
+
try:
|
| 123 |
+
dry_run = hf_hub_download(repo_id=self.repo_id, subfolder=self.model_name, filename='config.yml', local_dir=self.subfolder)
|
| 124 |
+
print('installed_pairs', self.installed_pairs, 'localfolder', self.localfolder, 'dry_run', type(dry_run), dry_run)
|
| 125 |
+
if isinstance(dry_run, str):
|
| 126 |
+
print('Add to set after dryrun', dry_run)
|
| 127 |
+
self.installed_pairs.add(localfolder)
|
| 128 |
+
except Exception as dryrunerror:
|
| 129 |
+
print('installed_pairs', self.installed_pairs, 'localfolder', self.localfolder, 'dry_runerror', dryrunerror)
|
| 130 |
except Exception as downloaderror:
|
| 131 |
response, message_text = str(downloaderror), f"Error downloading {self.model_name}: {downloaderror}."
|
| 132 |
print(downloaderror)
|