Spaces:
Sleeping
Sleeping
File size: 456 Bytes
2a46375 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import gradio as gr
import time
counter = 0
def update_counter():
"""버튼을 누를 때마다 counter 값을 증가시키고 반환합니다."""
global counter
counter += 1
return str(counter) # Gradio 텍스트 박스는 문자열을 받습니다.
with gr.Blocks() as demo:
text_output = gr.Textbox(label="버튼을 누른 횟수")
button = gr.Button("누르세요")
button.click(fn=update_counter, outputs=text_output)
demo.launch() |