Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,7 +107,6 @@ def bergamot(input_text: list[str] = Query(description="Input string or list of
|
|
| 107 |
"""
|
| 108 |
try:
|
| 109 |
import bergamot
|
| 110 |
-
# local_path = ''
|
| 111 |
# input_text = [input_text] if isinstance(input_text, str) else input_text
|
| 112 |
config = bergamot.ServiceConfig(numWorkers=4)
|
| 113 |
service = bergamot.Service(config)
|
|
@@ -130,12 +129,17 @@ def bergamot(input_text: list[str] = Query(description="Input string or list of
|
|
| 130 |
# 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.
|
| 131 |
local_path = hf_hub_download(repo_id=repo_id, subfolder=model_name, filename=file_path, local_dir=subfolder)
|
| 132 |
print(f"Downloaded to: {local_path}") # Downloaded to: deen/base/deen/config.yml
|
| 133 |
-
|
| 134 |
-
if localfolder in
|
|
|
|
|
|
|
| 135 |
installed_pairs.add(localfolder)
|
| 136 |
try:
|
| 137 |
dry_run = hf_hub_download(repo_id=repo_id, subfolder=model_name, filename='config.yml', local_dir=subfolder)
|
| 138 |
-
print('installed_pairs', installed_pairs, 'localfolder', localfolder, 'dry_run', dry_run)
|
|
|
|
|
|
|
|
|
|
| 139 |
except Exception as dryrunerror:
|
| 140 |
print('installed_pairs', installed_pairs, 'localfolder', localfolder, 'dry_runerror', dryrunerror)
|
| 141 |
model = service.modelFromConfigPath(f"{localfolder}/config.yml")
|
|
|
|
| 107 |
"""
|
| 108 |
try:
|
| 109 |
import bergamot
|
|
|
|
| 110 |
# input_text = [input_text] if isinstance(input_text, str) else input_text
|
| 111 |
config = bergamot.ServiceConfig(numWorkers=4)
|
| 112 |
service = bergamot.Service(config)
|
|
|
|
| 129 |
# 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.
|
| 130 |
local_path = hf_hub_download(repo_id=repo_id, subfolder=model_name, filename=file_path, local_dir=subfolder)
|
| 131 |
print(f"Downloaded to: {local_path}") # Downloaded to: deen/base/deen/config.yml
|
| 132 |
+
## Check if model/localfolder in repo files, add to set if exists
|
| 133 |
+
modelcheck = [i for i in all_files if localfolder in i]
|
| 134 |
+
if modelcheck:
|
| 135 |
+
print('Add to set after modelcheck')
|
| 136 |
installed_pairs.add(localfolder)
|
| 137 |
try:
|
| 138 |
dry_run = hf_hub_download(repo_id=repo_id, subfolder=model_name, filename='config.yml', local_dir=subfolder)
|
| 139 |
+
print('installed_pairs', installed_pairs, 'localfolder', localfolder, 'dry_run', type(dry_run), dry_run)
|
| 140 |
+
if isinstance(dry_run, str):
|
| 141 |
+
print('Add to set after dryrun')
|
| 142 |
+
installed_pairs.add(localfolder)
|
| 143 |
except Exception as dryrunerror:
|
| 144 |
print('installed_pairs', installed_pairs, 'localfolder', localfolder, 'dry_runerror', dryrunerror)
|
| 145 |
model = service.modelFromConfigPath(f"{localfolder}/config.yml")
|