File size: 2,042 Bytes
5d0a311
 
 
e5fc5ba
5d0a311
 
 
e7339fb
b1aa3b5
e5fc5ba
b1aa3b5
65816ec
b1aa3b5
 
8c97d69
b1aa3b5
 
65816ec
b1aa3b5
8c97d69
 
 
 
 
 
b1aa3b5
5d0a311
b1aa3b5
 
 
 
 
 
8c97d69
b1aa3b5
 
e5fc5ba
 
b1aa3b5
e5fc5ba
b1aa3b5
8c97d69
 
 
 
 
 
 
 
 
5d0a311
 
 
 
8c97d69
 
5d0a311
 
 
b1aa3b5
ba8ecf7
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import gradio as gr
from modules.m_connector import Connector

iface = gr.Blocks(css="css/style.css")
conn = Connector()

with iface:
    gr.HTML("<center><h5>🇺🇸 🇬🇧 2Passive Voice (Beta)</h5></center>")
    with gr.Row():
        with gr.Column():
            in_sentence = gr.Textbox(
                label = "Enter a sentence in active voice",
                max_lines=2,
                lines=1,
                placeholder = "Write here the sentence without contractions...",
            )
            btn_act2pas = gr.Button(
                value = "Convert to passive voice!"
            )
            str_out = gr.Markdown(
                label = "Output in string format",
                visible=False
            )
            html_out = gr.HTML(
                label = "Output in HTML format",
            )

        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",
                    "Michael Jackson sings Billy Jean",
                    "They are painting the house" ,
                    "My mom has prepared the dinner",
                    "The man has not found the farm",
                    "He closes the doors"
                ],
                examples_per_page=10
            )
    
    gr.HTML("""
    <center>
        <div class="alert alert-light" role="status">
            DISCLAIMER: At the moment the application only works well with sentences in the following tense: Simple present, Simple past, Simple future, Present continuous, Past continuous and Present perfect.
        </div>
    </center>
    """,
    )

    btn_act2pas.click(
        fn = conn.active2passive,
        inputs = in_sentence,
        outputs = [html_out, str_out],
        api_name="active2passive"
    )

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