Harveenchadha commited on
Commit
5476941
1 Parent(s): 86b5efd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -13,17 +13,19 @@ import gradio as grd
13
  from inference.engine import Model
14
  indic2en_model = Model(expdir='en-indic')
15
 
16
- def translate(text):
17
- return indic2en_model.translate_paragraph(text, 'en', 'hi')
 
 
 
18
 
19
 
20
- INDIC = {"Assamese": "as", "Bengali": "bn", "Gujarati": "gu", "Hindi": "hi","Kannada": "kn","Malayalam": "ml", "Marathi": "mr", "Odia": "or","Punjabi": "pa","Tamil": "ta", "Telugu" : "te"}
21
 
22
  languages = INDIC.keys()
23
 
24
- print(translate('helo how are you'))
25
- ddwn = gradio.inputs.Dropdown(languages, type="value", default="Hindi", label="Select Target Language")
26
 
27
 
28
  iface = grd.Interface(fn=translate, inputs=["text",ddwn] , outputs="text")
29
- iface.launch()
 
13
  from inference.engine import Model
14
  indic2en_model = Model(expdir='en-indic')
15
 
16
+ INDIC = {"Assamese": "as", "Bengali": "bn", "Gujarati": "gu", "Hindi": "hi","Kannada": "kn","Malayalam": "ml", "Marathi": "mr", "Odia": "or","Punjabi": "pa","Tamil": "ta", "Telugu" : "te"}
17
+
18
+
19
+ def translate(text, lang):
20
+ return indic2en_model.translate_paragraph(text, 'en', INDIC[lang])
21
 
22
 
 
23
 
24
  languages = INDIC.keys()
25
 
26
+ #print(translate('helo how are you'))
27
+ ddwn = grd.inputs.Dropdown(languages, type="value", default="Hindi", label="Select Target Language")
28
 
29
 
30
  iface = grd.Interface(fn=translate, inputs=["text",ddwn] , outputs="text")
31
+ iface.launch(enable_queue=True)