Spaces:
Building
Building
File size: 741 Bytes
f33e2be 55cfbd7 f33e2be 55cfbd7 f33e2be 55cfbd7 f33e2be 55cfbd7 f33e2be 55cfbd7 f33e2be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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()
|