Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import requests | |
| st.title("Spatial Parser Demo") | |
| # 密码验证 | |
| password = st.text_input("Enter access password:", type="password") | |
| if password != "demo1234": | |
| st.warning("Please enter the correct password.") | |
| st.stop() | |
| # 输入框 | |
| text = st.text_area("Enter your spatial description:") | |
| if st.button("Submit"): | |
| with st.spinner("Calling secure backend..."): | |
| try: | |
| response = requests.post( | |
| "https://dsbb0707-SpatialParse_back.hf.space/predict", | |
| json={"text": text}, | |
| timeout=20 | |
| ) | |
| result = response.json().get("result", "No result returned.") | |
| st.success(f"Parsed Output:\n\n{result}") | |
| except Exception as e: | |
| st.error(f"Backend error: {e}") | |