research14 commited on
Commit
13434a8
·
1 Parent(s): c6c82c9

testing js

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  def echo_text(input_text):
4
  return input_text
5
 
6
- # Custom HTML and CSS to display input above output
7
  custom_interface = """
8
  <div style="text-align: center;">
9
  <label for="input-text">Input Text:</label><br>
@@ -12,12 +12,17 @@ custom_interface = """
12
  <label for="output-text">Output Text:</label><br>
13
  <textarea id="output-text" name="output_text" rows="5" cols="40" readonly style="width: 80%;"></textarea>
14
  </div>
 
 
 
 
 
15
  """
16
 
17
  iface = gr.Interface(
18
  fn=echo_text,
19
  inputs=gr.HTML(custom_interface), # Use custom HTML interface
20
- outputs=gr.Textbox("Output will be displayed here.", type="output"),
21
  live=True
22
  )
23
 
 
3
  def echo_text(input_text):
4
  return input_text
5
 
6
+ # Custom HTML and JavaScript to display input above output
7
  custom_interface = """
8
  <div style="text-align: center;">
9
  <label for="input-text">Input Text:</label><br>
 
12
  <label for="output-text">Output Text:</label><br>
13
  <textarea id="output-text" name="output_text" rows="5" cols="40" readonly style="width: 80%;"></textarea>
14
  </div>
15
+ <script>
16
+ document.getElementById("input-text").addEventListener("input", function() {
17
+ document.getElementById("output-text").value = this.value;
18
+ });
19
+ </script>
20
  """
21
 
22
  iface = gr.Interface(
23
  fn=echo_text,
24
  inputs=gr.HTML(custom_interface), # Use custom HTML interface
25
+ outputs=gr.Textbox("Output will be displayed here.", type="text"),
26
  live=True
27
  )
28