File size: 994 Bytes
05e69cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import streamlit as st
from backend.data_augmenter import BackTranslatorAugmenter

os.environ['NO_PROXY'] = '127.0.0.1'
st.set_page_config(layout="wide", page_title="Paraphraser.AI", page_icon="🤖")
st.title('Paraphraser.AI 🤖')
st.header("An intelligent sentence paraphraser")

model_selection = st.sidebar.selectbox(
    'Select a paraphraser:',
    ['Vladimir 🧑🏼','Maria 👩🏽'],
)

input_text = st.text_area('Please type the text to paraphrase')

class DummyAugmenter:
    def __init__(self, in_lang="en", out_lang="ru") -> None:
        pass
    def back_translate(self,text):
        return "La marche des vertueux est seumée d'obstacles"


if model_selection == 'Vladimir 🧑🏼':
    model = BackTranslatorAugmenter(in_lang="en", out_lang="ru")
if model_selection == 'Maria 👩🏽':
    model = BackTranslatorAugmenter(in_lang="en", out_lang="es")

if input_text:
    st.header(f"Paraphrased text :")
    st.write("".join(model.back_translate(input_text)))