abhy60098's picture
Update app.py
a54cb63 verified
Raw
History Blame Contribute Delete
623 Bytes
import gradio as gr
latest_command = ""
def send_command(command):
global latest_command
latest_command = command
return f"Command sent: {command}"
def get_command():
global latest_command
return latest_command
with gr.Blocks() as demo:
gr.Markdown("# Laptop Controller")
cmd = gr.Textbox(label="Command")
status = gr.Textbox(label="Status")
send_btn = gr.Button("Send Command")
send_btn.click(send_command, cmd, status)
get_btn = gr.Button("Get Latest Command")
latest = gr.Textbox(label="Latest Command")
get_btn.click(get_command, outputs=latest)
demo.launch()