Spaces:
Runtime error
Runtime error
File size: 1,144 Bytes
dab4040 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import streamlit as st
from transformers import pipeline
def main():
# Set page title
st.set_page_config(page_title="Language Translation App")
# Set app title
st.title("Language Translation App")
# Create text input box
text_input = st.text_input(label="Enter text to translate:")
# Create translation buttons
if st.button("Translate to Hindi"):
# Load Hindi translation model
model_checkpoint = "VinayakMane47/finetuned-en-to-hi"
translator = pipeline("translation", model=model_checkpoint)
# Translate text
translated_text = translator(text_input)
# Display translated text
st.write(translated_text[0]["translation_text"])
if st.button("Translate to Marathi"):
# Load Marathi translation model
model_checkpoint = "VinayakMane47/finetuned-en-to-mar"
translator = pipeline("translation", model=model_checkpoint)
# Translate text
translated_text = translator(text_input)
# Display translated text
st.write(translated_text[0]["translation_text"])
if __name__ == "__main__":
main()
|