Khanmx99 commited on
Commit
5622965
·
verified ·
1 Parent(s): 98f4e99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -1,25 +1,25 @@
1
- def agent():
2
- print("Hi, I am your simple AI agent.")
3
- while True:
4
- command = input("Enter a command (type 'quit' to exit): ").lower()
5
- if command == "quit":
6
- print("Goodbye!")
7
- break
8
- elif "time" in command:
9
- import datetime
10
- print("Current time is:", datetime.datetime.now().strftime("%H:%M:%S"))
11
- elif "add" in command:
12
- print("Example: add 2 3")
13
- parts = command.split()
14
- if len(parts) == 3 and parts[0] == "add":
15
- try:
16
- result = int(parts[1]) + int(parts[2])
17
- print("Result:", result)
18
- except ValueError:
19
- print("Please provide numbers.")
20
- else:
21
- print("Invalid add command format.")
22
- else:
23
- print("Sorry, I don't understand.")
24
 
25
- agent()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import datetime
3
+
4
+ st.title("Simple AI Agent")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ command = st.text_input("Enter your command:")
7
+
8
+ if command:
9
+ cmd = command.lower()
10
+ if cmd == "quit":
11
+ st.write("Goodbye!")
12
+ elif "time" in cmd:
13
+ st.write("Current time is:", datetime.datetime.now().strftime("%H:%M:%S"))
14
+ elif cmd.startswith("add"):
15
+ parts = cmd.split()
16
+ if len(parts) == 3:
17
+ try:
18
+ result = int(parts[1]) + int(parts[2])
19
+ st.write("Result:", result)
20
+ except ValueError:
21
+ st.write("Please provide valid numbers after 'add'.")
22
+ else:
23
+ st.write("Format: add number1 number2")
24
+ else:
25
+ st.write("Sorry, I don't understand.")