1
import gradio as gr
input1 = gr.TextArea(label="Text (100 words max)", value=example,
                                                             elem_id=f"input{i}")

I made a Text Area, and wanna get current text value from TextArea.

input1.value just returns default value that I assigned (In my case, example).

How can I get current value of TextArea?

sooyeon
  • 488
  • 1
  • 5
  • 16

1 Answers1

0

If you click a button you can pass the value as an input. For example

import gradio as gr
input1 = gr.TextArea(label="Text (100 words max)", value=example,
                                                             elem_id=f"input{i}")
btn = gr.Button(value="Submit")
btn.click(combine, inputs=[input1])

def combine(input1):
    print(input1)
cylegend
  • 163
  • 1
  • 2
  • 12