Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ from sacremoses import MosesPunctNormalizer
|
|
| 5 |
import re
|
| 6 |
import unicodedata
|
| 7 |
import sys
|
|
|
|
| 8 |
|
| 9 |
# -------------------------------------------------------------------
|
| 10 |
# Device & model loading
|
|
@@ -78,7 +79,7 @@ def preproc_generic(text: str) -> str:
|
|
| 78 |
# -------------------------------------------------------------------
|
| 79 |
# Core translation function (Formosan <-> English)
|
| 80 |
# -------------------------------------------------------------------
|
| 81 |
-
|
| 82 |
def translate(
|
| 83 |
text: str,
|
| 84 |
direction: str,
|
|
|
|
| 5 |
import re
|
| 6 |
import unicodedata
|
| 7 |
import sys
|
| 8 |
+
import spaces
|
| 9 |
|
| 10 |
# -------------------------------------------------------------------
|
| 11 |
# Device & model loading
|
|
|
|
| 79 |
# -------------------------------------------------------------------
|
| 80 |
# Core translation function (Formosan <-> English)
|
| 81 |
# -------------------------------------------------------------------
|
| 82 |
+
@spaces.GPU(duration=180)
|
| 83 |
def translate(
|
| 84 |
text: str,
|
| 85 |
direction: str,
|