Код: Выделить всё
import gradio as gr
with gr.Blocks() as demo:
radio = gr.Radio(["show", "hide"], label="Choose")
text = gr.Textbox(label="This text only shows when 'show' is selected.", visible=False)
def update_visibility(radio, text): # Accept the event argument, even if not used
value = radio # Get the selected value from the radio button
if value == "show":
text.visible = True
else:
text.visible = False
radio.change(update_visibility, [radio, text], text)
demo.launch()
Код: Выделить всё
AttributeError: 'str' object has no attribute 'visible'
Подробнее здесь: https://stackoverflow.com/questions/779 ... dio-button
Мобильная версия