File size: 1,269 Bytes
05e69cc
 
 
51636fd
05e69cc
51636fd
 
05e69cc
51636fd
05e69cc
 
 
51636fd
05e69cc
 
 
 
51636fd
 
05e69cc
 
 
 
 
 
 
 
 
 
 
51636fd
 
05e69cc
 
 
 
 
51636fd
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
34
35
36
37
38
import os
import streamlit as st
from backend.data_augmenter import BackTranslatorAugmenter
from footer import footer
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")
st.markdown('''This is a demo of a system that can rewrite some given paragraphs with slight differences.''')

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

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 model_selection == 'Jacques 👨':
    model = BackTranslatorAugmenter(in_lang="en", out_lang="fr")

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

footer()