Spaces:
Running
Running
Update disambiguation/disambiguate.py
Browse files- disambiguation/disambiguate.py +18 -18
disambiguation/disambiguate.py
CHANGED
@@ -18,24 +18,24 @@ import regex_spatial
|
|
18 |
import streamlit as st
|
19 |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
20 |
|
21 |
-
BACKEND_URL = "https://SpatialWebAgent-dockerb22.hf.space/api/predict/"
|
22 |
-
|
23 |
-
def call_backend(input_text):
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
|
41 |
|
|
|
18 |
import streamlit as st
|
19 |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
20 |
|
21 |
+
# BACKEND_URL = "https://SpatialWebAgent-dockerb22.hf.space/api/predict/"
|
22 |
+
|
23 |
+
# def call_backend(input_text):
|
24 |
+
# try:
|
25 |
+
# headers = {
|
26 |
+
# "Authorization": f"Bearer {API_TOKEN}"
|
27 |
+
# }
|
28 |
+
# response = requests.post(
|
29 |
+
# BACKEND_URL,
|
30 |
+
# headers=headers,
|
31 |
+
# json={"data": [input_text]},
|
32 |
+
# timeout=10
|
33 |
+
# )
|
34 |
+
# if response.status_code == 200:
|
35 |
+
# return response.json() # ✅ 保留原始 JSON 对象 (dict)
|
36 |
+
# return {"error": f"❌ Backend Error (HTTP {response.status_code})"}
|
37 |
+
# except Exception as e:
|
38 |
+
# return {"error": f"⚠️ Connection Error: {str(e)}"}
|
39 |
|
40 |
|
41 |
|