import streamlit as st from transformers import pipeline # Load translation pipeline (placeholder - you can load your fine-tuned model here) translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-hi") # Set Streamlit page config st.set_page_config(page_title="Translator", layout="wide") # UI Design starts here st.markdown(""" """, unsafe_allow_html=True) st.markdown('
English - Detected
Hindi
English
Spanish
All (50)
', unsafe_allow_html=True) st.markdown("---") # Create two columns col1, col2 = st.columns(2) with col1: st.markdown('
hi how are you
', unsafe_allow_html=True) user_input = st.text_area("", "hi how are you", height=250) translate_button = st.button("Translate", use_container_width=True) with col2: if translate_button and user_input: # Translate text translated_text = translator(user_input, max_length=400)[0]['translation_text'] else: translated_text = "" st.markdown('
' + (translated_text if translated_text else "") + '
', unsafe_allow_html=True) if translated_text: st.button("Copy", use_container_width=True) st.button("Paraphrase", use_container_width=True)