Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,7 +116,7 @@ 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 |
-
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)]
|
|
@@ -137,6 +137,7 @@ def bergamot(input_text: str = Query(description="Input strings"), sl: str = 'de
|
|
| 137 |
message_text = f"Translated from {sl} to {tl} with {model_name}."
|
| 138 |
except Exception as error:
|
| 139 |
response, message_text = str(error), str(error)
|
|
|
|
| 140 |
return {"input": input_text, "translated_text": response, "message_text": message_text}
|
| 141 |
|
| 142 |
@app.get("/embed", operation_id="get_embeddings", description="Embed text", tags=["embed"], summary="Embed text")
|
|
|
|
| 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)]
|
|
|
|
| 137 |
message_text = f"Translated from {sl} to {tl} with {model_name}."
|
| 138 |
except Exception as error:
|
| 139 |
response, message_text = str(error), str(error)
|
| 140 |
+
print(error)
|
| 141 |
return {"input": input_text, "translated_text": response, "message_text": message_text}
|
| 142 |
|
| 143 |
@app.get("/embed", operation_id="get_embeddings", description="Embed text", tags=["embed"], summary="Embed text")
|