|
|
import streamlit as st |
|
|
import sys |
|
|
import xmlrpc |
|
|
from xmlrpc import client |
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
st.set_page_config(page_title="Hindi-Sindhi MT Model", page_icon="🤖", layout='wide') |
|
|
st.markdown(""" |
|
|
<style> .block-container { |
|
|
padding-top: 1rem; |
|
|
padding-bottom: 0rem; |
|
|
padding-left: 5rem; |
|
|
padding-right: 5rem; |
|
|
} |
|
|
</style> |
|
|
""", unsafe_allow_html=True) |
|
|
|
|
|
st.header("Machine Translation System - Hindi to Sindhi", divider='rainbow') |
|
|
st.write("**-Developed at Speech and Language Processing Lab, Center for Artificial Intelligence, Banasthali Vidyapith. Sponsored by SERB, GoI, :flag-in:.**") |
|
|
|
|
|
|
|
|
|
|
|
def translate(source): |
|
|
proxy = xmlrpc.client.ServerProxy("http://localhost:8083/RPC2") |
|
|
print(source) |
|
|
text_translate = proxy.translate({"text":source}) ["text"] |
|
|
print(text_translate) |
|
|
lst = text_translate.split("\n") |
|
|
src = source.split("\n") |
|
|
final_output = '' |
|
|
for i in lst: |
|
|
final_output += i + '\n' |
|
|
return final_output |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c1, c2 = st.columns(2) |
|
|
element = c2.empty() |
|
|
|
|
|
user_input = c1.text_area("Source Text", max_chars=200000, height=500) |
|
|
output = element.text_area("Target Text", max_chars=200000, height=500) |
|
|
|
|
|
translation = translate(user_input) |
|
|
|
|
|
submitted = st.button("Translate") |
|
|
|
|
|
if submitted: |
|
|
new_output = element.text_area('New Target Text', value=translation, height=500, max_chars=200000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|