Spaces:
Runtime error
Runtime error
File size: 796 Bytes
11a5c67 7d707d7 11a5c67 7d707d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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}")
|