Ncert / app.py
witcher's picture
Update app.py
5457886 verified
raw
history blame contribute delete
695 Bytes
import streamlit as st
from transformers import pipeline
# Load translation pipeline
translation_pipe = pipeline("translation_en_to_awa", model="facebook/nllb-200-distilled-600M")
# Streamlit app
def main():
st.title("Text Translator")
# Input text box
input_text = st.text_area("Enter text to translate", "")
# Translate button
if st.button("Translate"):
if input_text.strip() != "":
translated_text = translation_pipe(input_text)[0]['translation_text']
st.write("Translated text:")
st.write(translated_text)
else:
st.warning("Please enter some text to translate.")
if __name__ == "__main__":
main()