Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,12 +21,12 @@ def index(request: Request):
|
|
| 21 |
</head>
|
| 22 |
<body>
|
| 23 |
<h2>FastAPI URLS</h2>
|
| 24 |
-
<p>Host URL
|
| 25 |
<p><a href="{host_url}/docs">DOCS</a></p>
|
| 26 |
-
<p><a href="{host_url}/redoc">REDOC</a></p>
|
| 27 |
-
<p><a href="{host_url}/openapi.json">openapi.json</a></p>
|
| 28 |
-
<p><a href="{host_url}/mcp">MCP</a></p>
|
| 29 |
-
<p>MTMODELS: {MTMODELS}"</p>
|
| 30 |
</body>
|
| 31 |
</html>
|
| 32 |
'''
|
|
@@ -45,10 +45,10 @@ def paraphrase(text: str, model: str):
|
|
| 45 |
@app.get("/translate", operation_id="get_translate", description="Translate text", tags=["translate"], summary="Translate text")
|
| 46 |
def translate(text: str, model: Optional[str] = MTMODELS['enro']):
|
| 47 |
if 'BlackKakapo' in model:
|
| 48 |
-
|
| 49 |
else:
|
| 50 |
-
|
| 51 |
-
return {"input": text, "
|
| 52 |
|
| 53 |
# Create an MCP server based on this app
|
| 54 |
mcp = FastApiMCP(
|
|
|
|
| 21 |
</head>
|
| 22 |
<body>
|
| 23 |
<h2>FastAPI URLS</h2>
|
| 24 |
+
<p><a href="{host_url}" target="_blank">Host URL:</a></p>
|
| 25 |
<p><a href="{host_url}/docs">DOCS</a></p>
|
| 26 |
+
<p><a href="{host_url}/redoc" >REDOC</a></p>
|
| 27 |
+
<p><a href="{host_url}/openapi.json" target="_blank">openapi.json</a></p>
|
| 28 |
+
<p><a href="{host_url}/mcp" target="_blank">MCP</a></p>
|
| 29 |
+
<p>MTMODELS: {MTMODELS.values()}"</p>
|
| 30 |
</body>
|
| 31 |
</html>
|
| 32 |
'''
|
|
|
|
| 45 |
@app.get("/translate", operation_id="get_translate", description="Translate text", tags=["translate"], summary="Translate text")
|
| 46 |
def translate(text: str, model: Optional[str] = MTMODELS['enro']):
|
| 47 |
if 'BlackKakapo' in model:
|
| 48 |
+
translation = Translate.paraphraseTranslateMethod(text, model)
|
| 49 |
else:
|
| 50 |
+
translation: str = Translate.gemma_direct(text, model)
|
| 51 |
+
return {"input": text, "translation": translation, "model": model}
|
| 52 |
|
| 53 |
# Create an MCP server based on this app
|
| 54 |
mcp = FastApiMCP(
|