Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,7 @@ def english_to_gujarati(text):
|
|
| 15 |
def translate_question(english_question):
|
| 16 |
gujarati_question = english_to_gujarati(english_question)
|
| 17 |
lst = [gujarati_question]
|
|
|
|
| 18 |
|
| 19 |
batch = ip.preprocess_batch(lst, src_lang="guj_Gujr", tgt_lang="eng_Latn")
|
| 20 |
batch = tokenizer(batch, padding="longest", truncation=True, max_length=256, return_tensors="pt")
|
|
@@ -28,15 +29,15 @@ def translate_question(english_question):
|
|
| 28 |
outputs = ip.postprocess_batch(outputs, lang="eng_Latn")
|
| 29 |
return outputs
|
| 30 |
|
| 31 |
-
st.title("Gujarati to English
|
| 32 |
-
st.write("Enter your question
|
| 33 |
|
| 34 |
english_question = st.text_input("Question:")
|
| 35 |
|
| 36 |
if st.button("Translate"):
|
| 37 |
if english_question:
|
| 38 |
translated = translate_question(english_question)
|
| 39 |
-
st.write("
|
| 40 |
else:
|
| 41 |
st.write("Please enter a question.")
|
| 42 |
|
|
|
|
| 15 |
def translate_question(english_question):
|
| 16 |
gujarati_question = english_to_gujarati(english_question)
|
| 17 |
lst = [gujarati_question]
|
| 18 |
+
st.write ("Gujarati Translation of the text:", gujarati_question)
|
| 19 |
|
| 20 |
batch = ip.preprocess_batch(lst, src_lang="guj_Gujr", tgt_lang="eng_Latn")
|
| 21 |
batch = tokenizer(batch, padding="longest", truncation=True, max_length=256, return_tensors="pt")
|
|
|
|
| 29 |
outputs = ip.postprocess_batch(outputs, lang="eng_Latn")
|
| 30 |
return outputs
|
| 31 |
|
| 32 |
+
st.title("Gujarati to English Translator")
|
| 33 |
+
st.write("Enter your question:")
|
| 34 |
|
| 35 |
english_question = st.text_input("Question:")
|
| 36 |
|
| 37 |
if st.button("Translate"):
|
| 38 |
if english_question:
|
| 39 |
translated = translate_question(english_question)
|
| 40 |
+
st.write("English translation of the user text:", translated)
|
| 41 |
else:
|
| 42 |
st.write("Please enter a question.")
|
| 43 |
|