Spaces:
Runtime error
Runtime error
0x7o
commited on
Commit
•
f4f4284
1
Parent(s):
0076f53
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
import time
|
|
|
5 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
6 |
from flores200_codes import flores_codes
|
7 |
|
@@ -22,6 +23,7 @@ def load_models():
|
|
22 |
return model_dict
|
23 |
|
24 |
|
|
|
25 |
def translation(source, target, text):
|
26 |
if len(model_dict) == 2:
|
27 |
model_name = 'nllb-distilled-1.3B'
|
@@ -65,10 +67,10 @@ if __name__ == '__main__':
|
|
65 |
|
66 |
title = "NLLB distilled 1.3B demo"
|
67 |
|
68 |
-
demo_status = "Demo is running on
|
69 |
description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
|
70 |
examples = [
|
71 |
-
['English', '
|
72 |
]
|
73 |
|
74 |
gr.Interface(translation,
|
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
import time
|
5 |
+
import spaces
|
6 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
7 |
from flores200_codes import flores_codes
|
8 |
|
|
|
23 |
return model_dict
|
24 |
|
25 |
|
26 |
+
@spaces.GPU
|
27 |
def translation(source, target, text):
|
28 |
if len(model_dict) == 2:
|
29 |
model_name = 'nllb-distilled-1.3B'
|
|
|
67 |
|
68 |
title = "NLLB distilled 1.3B demo"
|
69 |
|
70 |
+
demo_status = "Demo is running on A10G GPU"
|
71 |
description = f"Details: https://github.com/facebookresearch/fairseq/tree/nllb. {demo_status}"
|
72 |
examples = [
|
73 |
+
['English', 'Russian', 'Hi. nice to meet you']
|
74 |
]
|
75 |
|
76 |
gr.Interface(translation,
|