Spaces:
Building
Building
import streamlit as st | |
import requests | |
# Set the correct URL for the φ endpoint; note that the full path is /phi-response/ | |
API_URL_PHI = "http://localhost:7860/phi-response/" | |
def main(): | |
st.title("Quantum-API Chat Interface with φ") | |
user_input = st.text_input("Ask a question:") | |
if user_input: | |
if st.button("Chat with φ"): | |
# Send a POST request with the prompt | |
response = requests.post(API_URL_PHI, json={"query": user_input}) | |
if response.status_code == 200: | |
st.write(f"φ says: {response.json()['response']}") | |
else: | |
st.error(f"Error contacting φ API: {response.status_code} - {response.text}") | |
if __name__ == "__main__": | |
main() | |