CoolFace
Apppublic

witcher/Ncert

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
app.py26 linesDownload Raw Back to root
1import streamlit as st2from transformers import pipeline3 4# Load translation pipeline5translation_pipe = pipeline("translation_en_to_awa", model="facebook/nllb-200-distilled-600M")6 7# Streamlit app8def main():9    st.title("Text Translator")10 11    # Input text box12    input_text = st.text_area("Enter text to translate", "")13 14    # Translate button15    if st.button("Translate"):16        if input_text.strip() != "":17            translated_text = translation_pipe(input_text)[0]['translation_text']18            st.write("Translated text:")19            st.write(translated_text)20        else:21            st.warning("Please enter some text to translate.")22 23 24if __name__ == "__main__":25    main()26