diff --git a/main.py b/main.py index 2eb3715..7f1e4af 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,33 @@ -class HelloWorld: - def __init__(self): - print("Hello, World!") +import streamlit as st +import requests -if __name__ == "__main__": - hello = HelloWorld() +if "history" not in st.session_state: + st.session_state.history = [] + + +def send_post_request(prompt): + url = "http://localhost:19194/" + payload = prompt.title() + response = requests.post(url, json=payload) + + return response.text + + +st.title("Prompt History and Post Request App") + +prompt = st.text_input("Enter your prompt:") + +if st.button("Submit"): + if prompt: + st.session_state.history.append(prompt) + response = send_post_request(prompt) + + st.success(f"Response: {response}") + else: + st.error("Please enter a prompt") + +# Display history of prompts +if st.session_state.history: + st.write("### Prompt History") + for i, p in enumerate(st.session_state.history, 1): + st.write(f"{i}. {p}")