File size: 906 Bytes
e8e247e
081b46f
a845f21
 
6f1af31
13434a8
d901169
 
 
 
 
 
 
 
13434a8
 
 
 
 
d901169
 
ec7540b
75ef19a
c6c82c9
13434a8
771b9c6
b934ee9
182a838
1801662
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
import gradio as gr

def echo_text(input_text):
    return input_text

# Custom HTML and JavaScript to display input above output
custom_interface = """
<div style="text-align: center;">
    <label for="input-text">Input Text:</label><br>
    <input type="text" id="input-text" name="input_text" value="Enter text here..." style="width: 80%;"><br>
    <br>
    <label for="output-text">Output Text:</label><br>
    <textarea id="output-text" name="output_text" rows="5" cols="40" readonly style="width: 80%;"></textarea>
</div>
<script>
document.getElementById("input-text").addEventListener("input", function() {
    document.getElementById("output-text").value = this.value;
});
</script>
"""

iface = gr.Interface(
    fn=echo_text,
    inputs=gr.HTML(custom_interface),  # Use custom HTML interface
    outputs=gr.Textbox("Output will be displayed here.", type="text"),
    live=True
)

iface.launch()