Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -735,24 +735,24 @@ def main():
|
|
| 735 |
</style>
|
| 736 |
""", unsafe_allow_html=True)
|
| 737 |
|
| 738 |
-
# Header section
|
| 739 |
-
st.markdown("<h1 class='main-title'>π The Sport Chatbot</h1>", unsafe_allow_html=True
|
| 740 |
-
st.markdown("<h3 class='sub-title'>Using ESPN API</h3>", unsafe_allow_html=True
|
| 741 |
st.markdown("""
|
| 742 |
<p class='description'>
|
| 743 |
Hey there! π I can help you with information on Ice Hockey, Baseball, American Football, Soccer, and Basketball.
|
| 744 |
With access to the ESPN API, I'm up to date with the latest details for these sports up until October 2024.
|
| 745 |
</p>
|
| 746 |
-
""", unsafe_allow_html=True
|
| 747 |
|
| 748 |
st.markdown("""
|
| 749 |
<p class='description'>
|
| 750 |
Got any general questions? Feel free to askβI'll do my best to provide answers based on the information I've been trained on!
|
| 751 |
</p>
|
| 752 |
-
""", unsafe_allow_html=True
|
| 753 |
|
| 754 |
# Add spacing
|
| 755 |
-
st.markdown("<br>", unsafe_allow_html=True
|
| 756 |
|
| 757 |
# Initialize the pipeline with better error handling
|
| 758 |
if 'rag' not in st.session_state:
|
|
@@ -762,7 +762,7 @@ def main():
|
|
| 762 |
logging.info("Pipeline initialized successfully")
|
| 763 |
except Exception as e:
|
| 764 |
logging.error(f"Pipeline initialization error: {str(e)}")
|
| 765 |
-
st.error("Failed to initialize the system. Please check the logs."
|
| 766 |
st.stop()
|
| 767 |
return
|
| 768 |
|
|
@@ -795,29 +795,23 @@ def main():
|
|
| 795 |
# Log error details
|
| 796 |
logging.error(f"Query processing error: {str(e)}")
|
| 797 |
logging.error("Full error details: ", exc_info=True)
|
| 798 |
-
response_placeholder.warning(
|
| 799 |
-
"Unable to process your question. Please try again.",
|
| 800 |
-
key="query_error"
|
| 801 |
-
)
|
| 802 |
else:
|
| 803 |
-
st.warning("Please enter a question!"
|
| 804 |
|
| 805 |
-
# Footer
|
| 806 |
-
st.markdown("<br><br>", unsafe_allow_html=True
|
| 807 |
-
st.markdown("---"
|
| 808 |
st.markdown("""
|
| 809 |
<p style='text-align: center; color: #666666; padding: 1rem 0;'>
|
| 810 |
Powered by ESPN Data & Mistral AI π
|
| 811 |
</p>
|
| 812 |
-
""", unsafe_allow_html=True
|
| 813 |
|
| 814 |
except Exception as e:
|
| 815 |
logging.error(f"Application error: {str(e)}")
|
| 816 |
logging.error("Full error details: ", exc_info=True)
|
| 817 |
-
st.error(
|
| 818 |
-
"An unexpected error occurred. Please check the logs and try again.",
|
| 819 |
-
key="main_error"
|
| 820 |
-
)
|
| 821 |
|
| 822 |
if __name__ == "__main__":
|
| 823 |
# Configure logging
|
|
@@ -831,7 +825,4 @@ if __name__ == "__main__":
|
|
| 831 |
except Exception as e:
|
| 832 |
logging.error(f"Fatal error: {str(e)}")
|
| 833 |
logging.error("Full error details: ", exc_info=True)
|
| 834 |
-
st.error(
|
| 835 |
-
"A fatal error occurred. Please check the logs and try again.",
|
| 836 |
-
key="fatal_error"
|
| 837 |
-
)
|
|
|
|
| 735 |
</style>
|
| 736 |
""", unsafe_allow_html=True)
|
| 737 |
|
| 738 |
+
# Header section
|
| 739 |
+
st.markdown("<h1 class='main-title'>π The Sport Chatbot</h1>", unsafe_allow_html=True)
|
| 740 |
+
st.markdown("<h3 class='sub-title'>Using ESPN API</h3>", unsafe_allow_html=True)
|
| 741 |
st.markdown("""
|
| 742 |
<p class='description'>
|
| 743 |
Hey there! π I can help you with information on Ice Hockey, Baseball, American Football, Soccer, and Basketball.
|
| 744 |
With access to the ESPN API, I'm up to date with the latest details for these sports up until October 2024.
|
| 745 |
</p>
|
| 746 |
+
""", unsafe_allow_html=True)
|
| 747 |
|
| 748 |
st.markdown("""
|
| 749 |
<p class='description'>
|
| 750 |
Got any general questions? Feel free to askβI'll do my best to provide answers based on the information I've been trained on!
|
| 751 |
</p>
|
| 752 |
+
""", unsafe_allow_html=True)
|
| 753 |
|
| 754 |
# Add spacing
|
| 755 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 756 |
|
| 757 |
# Initialize the pipeline with better error handling
|
| 758 |
if 'rag' not in st.session_state:
|
|
|
|
| 762 |
logging.info("Pipeline initialized successfully")
|
| 763 |
except Exception as e:
|
| 764 |
logging.error(f"Pipeline initialization error: {str(e)}")
|
| 765 |
+
st.error("Failed to initialize the system. Please check the logs.")
|
| 766 |
st.stop()
|
| 767 |
return
|
| 768 |
|
|
|
|
| 795 |
# Log error details
|
| 796 |
logging.error(f"Query processing error: {str(e)}")
|
| 797 |
logging.error("Full error details: ", exc_info=True)
|
| 798 |
+
response_placeholder.warning("Unable to process your question. Please try again.")
|
|
|
|
|
|
|
|
|
|
| 799 |
else:
|
| 800 |
+
st.warning("Please enter a question!")
|
| 801 |
|
| 802 |
+
# Footer
|
| 803 |
+
st.markdown("<br><br>", unsafe_allow_html=True)
|
| 804 |
+
st.markdown("---")
|
| 805 |
st.markdown("""
|
| 806 |
<p style='text-align: center; color: #666666; padding: 1rem 0;'>
|
| 807 |
Powered by ESPN Data & Mistral AI π
|
| 808 |
</p>
|
| 809 |
+
""", unsafe_allow_html=True)
|
| 810 |
|
| 811 |
except Exception as e:
|
| 812 |
logging.error(f"Application error: {str(e)}")
|
| 813 |
logging.error("Full error details: ", exc_info=True)
|
| 814 |
+
st.error("An unexpected error occurred. Please check the logs and try again.")
|
|
|
|
|
|
|
|
|
|
| 815 |
|
| 816 |
if __name__ == "__main__":
|
| 817 |
# Configure logging
|
|
|
|
| 825 |
except Exception as e:
|
| 826 |
logging.error(f"Fatal error: {str(e)}")
|
| 827 |
logging.error("Full error details: ", exc_info=True)
|
| 828 |
+
st.error("A fatal error occurred. Please check the logs and try again.")
|
|
|
|
|
|
|
|
|