File size: 749 Bytes
5622965 e9b546b 5622965 e6c347f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import streamlit as st
import datetime
st.title("Simple AI Agent")
command = st.text_input("Enter your command:")
if command:
cmd = command.lower()
if cmd == "quit":
st.write("Goodbye!")
elif "time" in cmd:
st.write("Current time is:", datetime.datetime.now().strftime("%H:%M:%S"))
elif cmd.startswith("add"):
parts = cmd.split()
if len(parts) == 3:
try:
result = int(parts[1]) + int(parts[2])
st.write("Result:", result)
except ValueError:
st.write("Please provide valid numbers after 'add'.")
else:
st.write("Format: add number1 number2")
else:
st.write("Sorry, I don't understand.")
|