Deadsg / B.A.T.M.A.N

0 stars 0 forks source link

Streamlit Command processor #11

Open Deadsg opened 1 year ago

Deadsg commented 1 year ago

def process_hello_command(): return "Hello! How can I assist you?"

def process_goodbye_command(): return "Goodbye! Have a great day!"

def process_default_command(): return "Sorry, I don't understand that command."

import streamlit as st

import command_processor

def main(): st.title("Streamlit Command Processor")

# User input
user_input = st.text_input("You:", value="")

if st.button("Send"):
    if user_input.startswith("!"):
        command = user_input[1:]
        if command == "hello":
            command_response = command_processor.process_hello_command()
        elif command == "goodbye":
            command_response = command_processor.process_goodbye_command()
        else:
            command_response = command_processor.process_default_command()

        st.text("Command Result:")
        st.text(command_response)
    else:
        st.text("Regular message processing logic here...")

if name == "main": main()