Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,12 +113,6 @@ 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 |
-
## Check if model/localfolder in repo files, add to set if exists
|
| 117 |
-
modelcheck = [i for i in self.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)
|
|
@@ -149,7 +143,7 @@ class Bergamot:
|
|
| 149 |
|
| 150 |
# 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
|
| 151 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
| 152 |
-
def
|
| 153 |
"""
|
| 154 |
Translates the input text from the source language to the target language using a specified model.
|
| 155 |
Parameters:
|
|
|
|
| 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 |
try:
|
| 117 |
dry_run = hf_hub_download(repo_id=self.repo_id, subfolder=self.model_name, filename='config.yml', local_dir=self.subfolder)
|
| 118 |
print('installed_pairs', self.installed_pairs, 'localfolder', self.localfolder, 'dry_run', type(dry_run), dry_run)
|
|
|
|
| 143 |
|
| 144 |
# 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
|
| 145 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
| 146 |
+
def bergamott(input_text: list[str] = Query(description="Input string or list of strings"), sl: str = 'de', tl: str = 'en', model_name: Optional[str] = 'base/deen'):
|
| 147 |
"""
|
| 148 |
Translates the input text from the source language to the target language using a specified model.
|
| 149 |
Parameters:
|