jeyasee commited on
Commit
e7e13d1
·
verified ·
1 Parent(s): 7129900

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -14,8 +14,7 @@ def detect_language(sentence):
14
  output = model(**tokenized_sentence)
15
  predictions = torch.nn.functional.softmax(output.logits, dim=-1)
16
  _, preds = torch.max(predictions, dim=-1)
17
- return preds.item()
18
- #return LANGUANGE_MAP[preds.item()]
19
 
20
  examples = [
21
  "My Language detector using HuggingFace space.",
@@ -26,10 +25,6 @@ examples = [
26
  "もう食べましたか?",
27
  "as-tu mangé",
28
  "أريد أن ألعب كرة الريشة",
29
- "హలో",
30
- "ഹലോ",
31
- "नमस्ते",
32
- "terima kasih"
33
 
34
  ]
35
 
@@ -41,7 +36,7 @@ Supported languages:\n
41
  'Dhivehi', 'Dutch', 'English', 'Esperanto', 'Estonian', 'French', 'Frisian', 'Georgian', 'German', 'Greek', 'Hakha_Chin',
42
  'Indonesian', 'Interlingua', 'Italian', 'Japanese', 'Kabyle', 'Kinyarwanda', 'Kyrgyz', 'Latvian', 'Maltese',
43
  'Mangolian', 'Persian', 'Polish', 'Portuguese', 'Romanian', 'Romansh_Sursilvan', 'Russian', 'Sakha', 'Slovenian',
44
- 'Spanish', 'Swedish', 'Tamil', 'Tatar', 'Turkish', 'Ukranian', 'Welsh','Hindi','Telugu','Malayalam','Karnataka','Malay'
45
  """
46
  Label = gr.Label(num_top_classes=3)
47
  gr.Interface(
 
14
  output = model(**tokenized_sentence)
15
  predictions = torch.nn.functional.softmax(output.logits, dim=-1)
16
  _, preds = torch.max(predictions, dim=-1)
17
+ return LANGUANGE_MAP[preds.item()]
 
18
 
19
  examples = [
20
  "My Language detector using HuggingFace space.",
 
25
  "もう食べましたか?",
26
  "as-tu mangé",
27
  "أريد أن ألعب كرة الريشة",
 
 
 
 
28
 
29
  ]
30
 
 
36
  'Dhivehi', 'Dutch', 'English', 'Esperanto', 'Estonian', 'French', 'Frisian', 'Georgian', 'German', 'Greek', 'Hakha_Chin',
37
  'Indonesian', 'Interlingua', 'Italian', 'Japanese', 'Kabyle', 'Kinyarwanda', 'Kyrgyz', 'Latvian', 'Maltese',
38
  'Mangolian', 'Persian', 'Polish', 'Portuguese', 'Romanian', 'Romansh_Sursilvan', 'Russian', 'Sakha', 'Slovenian',
39
+ 'Spanish', 'Swedish', 'Tamil', 'Tatar', 'Turkish', 'Ukranian', 'Welsh'
40
  """
41
  Label = gr.Label(num_top_classes=3)
42
  gr.Interface(