File size: 1,504 Bytes
5d0a311
 
 
 
 
 
 
b1aa3b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d0a311
b1aa3b5
 
 
 
 
 
 
 
 
 
 
 
 
5d0a311
 
 
 
b1aa3b5
5d0a311
 
 
 
b1aa3b5
cba89ba
5d0a311
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
39
40
41
42
43
44
45
46
47
48
49
import gradio as gr
from modules.m_connector import Connector

iface = gr.Blocks(css="container {max-width: 78%; margin: auto;}")
conn = Connector()

with iface:
    gr.Markdown("<center><h5>Active to Passive Voice</h5></center>")
    with gr.Row():
        with gr.Column(scale=2):
            in_sentence = gr.Textbox(
                label = "Active sentence",
                max_lines=2,
                lines=1,
                placeholder = "Enter here the sentence without contractions...",
            )
            btn_act2pas = gr.Button(
                value = "Pass to passive!"
            )
            out = gr.HTML(
                label = "Out. Pasive sentences:",
                elem_id=".btn-group"
            )

        with gr.Column(variant='panel'):
            gr.Examples(
                inputs = in_sentence,
                examples = [
                    "The teacher corrected the exams in less than an hour",
                    "Christopher Columbus discovered America in 1492",
                    "Mchael Jackson sings Billy Jean",
                    "They are painting the house" ,
                    "My mom has prepared the dinner",
                    "The man has not found the farm"
                ],
                examples_per_page=5
            )

    btn_act2pas.click(
        fn = conn.active2passive,
        inputs = in_sentence,
        outputs = out
    )

iface.launch(
    # server_port= 9090,
    server_name = "0.0.0.0",
    # share = True
)