Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,7 +87,7 @@ installed_pairs = set()
|
|
| 87 |
|
| 88 |
# https://tiberiucristianleon-fastapimt.hf.space/bergamot?input_text=das%20ist%20keine%20gute%20Frau&input_text=das%20ist%20eine%20gute%20Nachricht&sl=de&tl=en&model=bergamot
|
| 89 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
| 90 |
-
def bergamot(input_text:
|
| 91 |
"""
|
| 92 |
Translates the input text from the source language to the target language using a specified model.
|
| 93 |
Parameters:
|
|
@@ -116,7 +116,7 @@ def bergamot(input_text: list[str] = Query(description="Input list of strings"),
|
|
| 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(all_files, len(all_files))
|
| 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)]
|
|
|
|
| 87 |
|
| 88 |
# https://tiberiucristianleon-fastapimt.hf.space/bergamot?input_text=das%20ist%20keine%20gute%20Frau&input_text=das%20ist%20eine%20gute%20Nachricht&sl=de&tl=en&model=bergamot
|
| 89 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
| 90 |
+
def bergamot(input_text: str = Query(description="Input strings"), sl: str = 'de', tl: str = 'en', model_name: Optional[str] = 'deen'):
|
| 91 |
"""
|
| 92 |
Translates the input text from the source language to the target language using a specified model.
|
| 93 |
Parameters:
|
|
|
|
| 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(all_files, len(all_files))
|
| 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)]
|