NeerAbhy commited on
Commit
47a0256
1 Parent(s): a8c9cb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +104 -0
app.py CHANGED
@@ -15,12 +15,116 @@ def text_to_sentimient(audio):
15
  #text = transcription(audio)["text"]
16
  return clasification(audio)
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  demo = gr.Blocks()
19
 
20
  with demo:
21
  gr.Markdown("Speech analyzer")
22
  audio = gr.Audio(type="filepath", label = "Upload a file")
23
  text = gr.Textbox()
 
24
  b1 = gr.Button("convert to text")
25
  b1.click(audio_a_text, inputs=audio, outputs=text)
26
 
 
15
  #text = transcription(audio)["text"]
16
  return clasification(audio)
17
 
18
+ lang_id = {
19
+ "Afrikaans": "af",
20
+ "Amharic": "am",
21
+ "Arabic": "ar",
22
+ "Asturian": "ast",
23
+ "Azerbaijani": "az",
24
+ "Bashkir": "ba",
25
+ "Belarusian": "be",
26
+ "Bulgarian": "bg",
27
+ "Bengali": "bn",
28
+ "Breton": "br",
29
+ "Bosnian": "bs",
30
+ "Catalan": "ca",
31
+ "Cebuano": "ceb",
32
+ "Czech": "cs",
33
+ "Welsh": "cy",
34
+ "Danish": "da",
35
+ "German": "de",
36
+ "Greeek": "el",
37
+ "English": "en",
38
+ "Spanish": "es",
39
+ "Estonian": "et",
40
+ "Persian": "fa",
41
+ "Fulah": "ff",
42
+ "Finnish": "fi",
43
+ "French": "fr",
44
+ "Western Frisian": "fy",
45
+ "Irish": "ga",
46
+ "Gaelic": "gd",
47
+ "Galician": "gl",
48
+ "Gujarati": "gu",
49
+ "Hausa": "ha",
50
+ "Hebrew": "he",
51
+ "Hindi": "hi",
52
+ "Croatian": "hr",
53
+ "Haitian": "ht",
54
+ "Hungarian": "hu",
55
+ "Armenian": "hy",
56
+ "Indonesian": "id",
57
+ "Igbo": "ig",
58
+ "Iloko": "ilo",
59
+ "Icelandic": "is",
60
+ "Italian": "it",
61
+ "Japanese": "ja",
62
+ "Javanese": "jv",
63
+ "Georgian": "ka",
64
+ "Kazakh": "kk",
65
+ "Central Khmer": "km",
66
+ "Kannada": "kn",
67
+ "Korean": "ko",
68
+ "Luxembourgish": "lb",
69
+ "Ganda": "lg",
70
+ "Lingala": "ln",
71
+ "Lao": "lo",
72
+ "Lithuanian": "lt",
73
+ "Latvian": "lv",
74
+ "Malagasy": "mg",
75
+ "Macedonian": "mk",
76
+ "Malayalam": "ml",
77
+ "Mongolian": "mn",
78
+ "Marathi": "mr",
79
+ "Malay": "ms",
80
+ "Burmese": "my",
81
+ "Nepali": "ne",
82
+ "Dutch": "nl",
83
+ "Norwegian": "no",
84
+ "Northern Sotho": "ns",
85
+ "Occitan": "oc",
86
+ "Oriya": "or",
87
+ "Panjabi": "pa",
88
+ "Polish": "pl",
89
+ "Pushto": "ps",
90
+ "Portuguese": "pt",
91
+ "Romanian": "ro",
92
+ "Russian": "ru",
93
+ "Sindhi": "sd",
94
+ "Sinhala": "si",
95
+ "Slovak": "sk",
96
+ "Slovenian": "sl",
97
+ "Somali": "so",
98
+ "Albanian": "sq",
99
+ "Serbian": "sr",
100
+ "Swati": "ss",
101
+ "Sundanese": "su",
102
+ "Swedish": "sv",
103
+ "Swahili": "sw",
104
+ "Tamil": "ta",
105
+ "Thai": "th",
106
+ "Tagalog": "tl",
107
+ "Tswana": "tn",
108
+ "Turkish": "tr",
109
+ "Ukrainian": "uk",
110
+ "Urdu": "ur",
111
+ "Uzbek": "uz",
112
+ "Vietnamese": "vi",
113
+ "Wolof": "wo",
114
+ "Xhosa": "xh",
115
+ "Yiddish": "yi",
116
+ "Yoruba": "yo",
117
+ "Chinese": "zh",
118
+ "Zulu": "zu",
119
+ }
120
+
121
  demo = gr.Blocks()
122
 
123
  with demo:
124
  gr.Markdown("Speech analyzer")
125
  audio = gr.Audio(type="filepath", label = "Upload a file")
126
  text = gr.Textbox()
127
+ source_lang = gr.selectbox(label="Source language", options=list(lang_id.keys()))
128
  b1 = gr.Button("convert to text")
129
  b1.click(audio_a_text, inputs=audio, outputs=text)
130