Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,18 @@ translator = pipeline('translation', model=model_checkpoint, decoder_start_token
|
|
10 |
st.title('NLTM')
|
11 |
|
12 |
st.header('Hindi-Sanskrit Translation Model')
|
|
|
13 |
|
14 |
query = st.text_input("Enter the Input Sentence", "")
|
15 |
-
|
16 |
input_sentence = query + ' </s>' + ' <2hi>'
|
17 |
-
output_sentence = translator(input_sentence,max_length=128)
|
18 |
-
output_sentence = output_sentence[0]["translation_text"]
|
19 |
-
output_sentence = output_sentence.replace('<2sa>','')
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
st.title('NLTM')
|
11 |
|
12 |
st.header('Hindi-Sanskrit Translation Model')
|
13 |
+
submit = st.button('Translate')
|
14 |
|
15 |
query = st.text_input("Enter the Input Sentence", "")
|
|
|
16 |
input_sentence = query + ' </s>' + ' <2hi>'
|
|
|
|
|
|
|
17 |
|
18 |
+
if submit:
|
19 |
+
st.subheader('Sanskrit Sentence')
|
20 |
+
|
21 |
+
with st.spinner(text='This may take a moment...'):
|
22 |
+
output_sentence = translator(input_sentence,max_length=128)
|
23 |
+
|
24 |
+
output_sentence = output_sentence[0]["translation_text"]
|
25 |
+
output_sentence = output_sentence.replace('<2sa>','')
|
26 |
+
|
27 |
+
st.write(output_sentence)
|