global_value_1 / app.py
yoon2566's picture
Rename main.py to app.py
3f8b64e verified
raw
history blame contribute delete
456 Bytes
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()