Spaces:
Running
on
Zero
Running
on
Zero
first commit
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
import torch
|
4 |
import logging
|
|
|
5 |
from typing import Literal, Tuple
|
6 |
|
7 |
# Set up logging
|
@@ -40,6 +41,7 @@ TARGET_LANG_OPTIONS = {
|
|
40 |
|
41 |
|
42 |
# Define the translation function with typing
|
|
|
43 |
def translate_text(text: str, source_lang: str, target_lang: str) -> str:
|
44 |
"""
|
45 |
Translate the input text from the source language to the target language using the NLLB model.
|
|
|
2 |
from transformers import pipeline
|
3 |
import torch
|
4 |
import logging
|
5 |
+
import spaces
|
6 |
from typing import Literal, Tuple
|
7 |
|
8 |
# Set up logging
|
|
|
41 |
|
42 |
|
43 |
# Define the translation function with typing
|
44 |
+
@spaces.GPU()
|
45 |
def translate_text(text: str, source_lang: str, target_lang: str) -> str:
|
46 |
"""
|
47 |
Translate the input text from the source language to the target language using the NLLB model.
|