sheonhan commited on
Commit
dfe3477
1 Parent(s): f54a85e
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -18,10 +18,10 @@ ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN")
18
  ACCESS_TOKEN = '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'
19
  headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}
20
 
21
-
22
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
23
  tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
24
  device = 0 if torch.cuda.is_available() else -1
 
25
 
26
  language_code_map = {
27
  "English": "eng_Latn",
@@ -61,6 +61,7 @@ def query(text, src_lang, tgt_lang):
61
 
62
  examples = [
63
  ["Hello, world", "English", "French"],
 
64
  ["Hasta la vista", "Spanish", "German"],
65
  ["동경에 휴가를 간다", "Korean", "Japanese"],
66
  ]
@@ -71,8 +72,6 @@ gr.Interface(
71
  gr.Textbox(lines=2),
72
  gr.Radio(["English", "Spanish", "Korean"], value="English", label="Source Language"),
73
  gr.Radio(["French", "German", "Japanese"], value="French", label="Target Language")
74
- # gr.Radio(["English", "French", "Korean"]),
75
- # gr.Radio(["Spanish", "German", "French"]),
76
  ],
77
  outputs=[
78
  gr.Textbox(lines=3, label="Detected Language"),
 
18
  ACCESS_TOKEN = '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'
19
  headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}
20
 
 
21
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
22
  tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
23
  device = 0 if torch.cuda.is_available() else -1
24
+ print(f"Is CUDA available: {torch.cuda.is_available()}")
25
 
26
  language_code_map = {
27
  "English": "eng_Latn",
 
61
 
62
  examples = [
63
  ["Hello, world", "English", "French"],
64
+ ["Can I have a cheeseburger?", "English", "German"],
65
  ["Hasta la vista", "Spanish", "German"],
66
  ["동경에 휴가를 간다", "Korean", "Japanese"],
67
  ]
 
72
  gr.Textbox(lines=2),
73
  gr.Radio(["English", "Spanish", "Korean"], value="English", label="Source Language"),
74
  gr.Radio(["French", "German", "Japanese"], value="French", label="Target Language")
 
 
75
  ],
76
  outputs=[
77
  gr.Textbox(lines=3, label="Detected Language"),