Spaces:
Sleeping
Sleeping
Abhishek Kumar
commited on
Commit
·
04287a2
1
Parent(s):
8ec847b
Update backend URL to use correct Hugging Face Space URL
Browse files- src/streamlit_app.py +7 -1
src/streamlit_app.py
CHANGED
@@ -49,7 +49,8 @@ if uploaded_file is not None:
|
|
49 |
|
50 |
try:
|
51 |
# Make request to the backend API
|
52 |
-
|
|
|
53 |
|
54 |
if response.status_code == 200:
|
55 |
predictions = response.json()["predictions"]
|
@@ -71,6 +72,11 @@ if uploaded_file is not None:
|
|
71 |
)
|
72 |
else:
|
73 |
st.error(f"Error getting predictions from the API. Status code: {response.status_code}")
|
|
|
|
|
|
|
|
|
|
|
74 |
except Exception as e:
|
75 |
st.error(f"Error: {str(e)}")
|
76 |
except Exception as e:
|
|
|
49 |
|
50 |
try:
|
51 |
# Make request to the backend API
|
52 |
+
backend_url = "https://abhishek-kumar-superkart-sales-backend.hf.space/predict"
|
53 |
+
response = requests.post(backend_url, files=files, timeout=30)
|
54 |
|
55 |
if response.status_code == 200:
|
56 |
predictions = response.json()["predictions"]
|
|
|
72 |
)
|
73 |
else:
|
74 |
st.error(f"Error getting predictions from the API. Status code: {response.status_code}")
|
75 |
+
st.error(f"Response: {response.text}")
|
76 |
+
except requests.exceptions.Timeout:
|
77 |
+
st.error("Request timed out. Please try again.")
|
78 |
+
except requests.exceptions.RequestException as e:
|
79 |
+
st.error(f"Error connecting to the API: {str(e)}")
|
80 |
except Exception as e:
|
81 |
st.error(f"Error: {str(e)}")
|
82 |
except Exception as e:
|