Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from transformers import pipeline
|
|
| 3 |
|
| 4 |
app = FastAPI(title="English–Persian Translator")
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
@app.get("/")
|
| 9 |
def home():
|
|
@@ -11,5 +11,5 @@ def home():
|
|
| 11 |
|
| 12 |
@app.get("/translate")
|
| 13 |
def translate(text: str = Query(...)):
|
| 14 |
-
result =
|
| 15 |
-
return {"input": text, "translation": result[0]
|
|
|
|
| 3 |
|
| 4 |
app = FastAPI(title="English–Persian Translator")
|
| 5 |
|
| 6 |
+
pipe = pipeline("translation", model="sarvamai/sarvam-translate")
|
| 7 |
|
| 8 |
@app.get("/")
|
| 9 |
def home():
|
|
|
|
| 11 |
|
| 12 |
@app.get("/translate")
|
| 13 |
def translate(text: str = Query(...)):
|
| 14 |
+
result = pipe(text)
|
| 15 |
+
return {"input": text, "translation": result[0]}
|