import streamlit as st import requests 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}")