Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,16 +116,17 @@ def bergamot(input_text: str = Query(description="Input strings"), sl: str = 'de
|
|
| 116 |
subfolder = f"{sl}{tl}"
|
| 117 |
# List all files in the repo
|
| 118 |
all_files = list_repo_files(repo_id, repo_type='model')
|
| 119 |
-
|
| 120 |
for branch in branches:
|
| 121 |
branch_files = [f for f in all_files if f.startswith(branch)]
|
| 122 |
model_files = [f for f in branch_files if f.startswith(model_name)]
|
|
|
|
| 123 |
for file_path in model_files:
|
| 124 |
if subfolder not in file_path:
|
| 125 |
local_path = hf_hub_download(repo_id=repo_id, filename=file_path)
|
| 126 |
print(f"Downloaded to: {local_path}")
|
| 127 |
installed_pairs.add(subfolder)
|
| 128 |
-
print('
|
| 129 |
model = service.modelFromConfigPath(f"./{model_name}/config.yml")
|
| 130 |
options = bergamot.ResponseOptions(alignment=False, qualityScores=False, HTML=False)
|
| 131 |
rawresponse = service.translate(model, bergamot.VectorString([input_text]), options)
|
|
|
|
| 116 |
subfolder = f"{sl}{tl}"
|
| 117 |
# List all files in the repo
|
| 118 |
all_files = list_repo_files(repo_id, repo_type='model')
|
| 119 |
+
print(len(all_files, 'installed_pairs', installed_pairs))
|
| 120 |
for branch in branches:
|
| 121 |
branch_files = [f for f in all_files if f.startswith(branch)]
|
| 122 |
model_files = [f for f in branch_files if f.startswith(model_name)]
|
| 123 |
+
print('branch_files', branch_files, 'model_files', model_files)
|
| 124 |
for file_path in model_files:
|
| 125 |
if subfolder not in file_path:
|
| 126 |
local_path = hf_hub_download(repo_id=repo_id, filename=file_path)
|
| 127 |
print(f"Downloaded to: {local_path}")
|
| 128 |
installed_pairs.add(subfolder)
|
| 129 |
+
print('installed_pairs', installed_pairs)
|
| 130 |
model = service.modelFromConfigPath(f"./{model_name}/config.yml")
|
| 131 |
options = bergamot.ResponseOptions(alignment=False, qualityScores=False, HTML=False)
|
| 132 |
rawresponse = service.translate(model, bergamot.VectorString([input_text]), options)
|