Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import src.Paraphrase as Paraphrase
|
|
3 |
import src.Translate as Translate
|
4 |
from typing import Optional
|
5 |
from fastapi_mcp import FastApiMCP
|
|
|
6 |
|
7 |
app = FastAPI()
|
8 |
# app = FastAPI(docs_url="/docs")
|
@@ -54,7 +55,8 @@ def translate(text: str, model: Optional[str] = MODELS['enro']):
|
|
54 |
return {"input": text, "result": translation, "model": model}
|
55 |
|
56 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
57 |
-
def bergamot(input_text: str, sl: str = 'de', tl: str = 'en', model: Optional[str] = 'bergamot'):
|
|
|
58 |
try:
|
59 |
import bergamot
|
60 |
config = bergamot.ServiceConfig(numWorkers=4)
|
|
|
3 |
import src.Translate as Translate
|
4 |
from typing import Optional
|
5 |
from fastapi_mcp import FastApiMCP
|
6 |
+
from typing import Union
|
7 |
|
8 |
app = FastAPI()
|
9 |
# app = FastAPI(docs_url="/docs")
|
|
|
55 |
return {"input": text, "result": translation, "model": model}
|
56 |
|
57 |
@app.get("/bergamot", operation_id="get_bergamot", description="Translate text with Bergamot", tags=["bergamot"], summary="Translate text with Bergamot")
|
58 |
+
# def bergamot(input_text: str, sl: str = 'de', tl: str = 'en', model: Optional[str] = 'bergamot'):
|
59 |
+
def bergamot(input_text: Union[str, list[str]], sl: str = 'de', tl: str = 'en', model: Optional[str] = 'bergamot'):
|
60 |
try:
|
61 |
import bergamot
|
62 |
config = bergamot.ServiceConfig(numWorkers=4)
|