Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import src.Paraphrase as Paraphrase
|
|
3 |
import src.Translate as Translate
|
4 |
from typing import Optional
|
5 |
|
6 |
-
app = FastAPI(
|
|
|
7 |
MTMODELS = {'enro': 'BlackKakapo/opus-mt-en-ro',
|
8 |
'roen': 'BlackKakapo/opus-mt-ro-en',
|
9 |
'gemma': 'Gargaz/gemma-2b-romanian-better'}
|
@@ -21,4 +22,11 @@ def paraphrase(text: str, model: str):
|
|
21 |
def translate(text: str, model: Optional[str] = MTMODELS['gemma']):
|
22 |
# resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
|
23 |
resultValue = Translate.gemma_direct(text, model)
|
24 |
-
return {"input": text, "result": resultValue, "model": model}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import src.Translate as Translate
|
4 |
from typing import Optional
|
5 |
|
6 |
+
app = FastAPI()
|
7 |
+
# app = FastAPI(docs_url="/")
|
8 |
MTMODELS = {'enro': 'BlackKakapo/opus-mt-en-ro',
|
9 |
'roen': 'BlackKakapo/opus-mt-ro-en',
|
10 |
'gemma': 'Gargaz/gemma-2b-romanian-better'}
|
|
|
22 |
def translate(text: str, model: Optional[str] = MTMODELS['gemma']):
|
23 |
# resultValue, exception = Translate.paraphraseTranslateMethod(text, model)
|
24 |
resultValue = Translate.gemma_direct(text, model)
|
25 |
+
return {"input": text, "result": resultValue, "model": model}
|
26 |
+
|
27 |
+
from fastapi_mcp import FastApiMCP
|
28 |
+
# Create an MCP server based on this app
|
29 |
+
mcp = FastApiMCP(app)
|
30 |
+
|
31 |
+
# Mount the MCP server directly to your app
|
32 |
+
mcp.mount()
|