Snack_tracker / snack_tracker.py
Nastarang's picture
Update snack_tracker.py
c699ee8 verified
raw
history blame contribute delete
416 Bytes
import gradio as gr
with gr.Blocks() as demo:
food_box = gr.Number(value=10, label="Food Count")
status_box = gr.Textbox()
def eat(food):
if food > 0:
return {food_box: food - 1, status_box: "full"}
else:
return {status_box: "hungry"}
gr.Button("Eat").click(
fn=eat,
inputs=food_box,
outputs=[food_box, status_box]
)
demo.launch()