Spaces:
Runtime error
Runtime error
File size: 813 Bytes
11a5c67 7d707d7 11a5c67 7d707d7 e9c69f6 7d707d7 3a0c26d 7d707d7 69eefd7 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")
# 输入框
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
)
try:
st.write("Raw response:", response.text)
result = response.json().get("result", "No result returned.")
except Exception as e:
st.error(f"Backend error: {e}\nRaw response: {response.text}")
st.success(f"Parsed Output:\n\n{result}")
except Exception as e:
st.error(f"Backend error: {e}")
|