Spaces:
Runtime error
Runtime error
Update app.py
Browse files51 unmodified lines525354555657585960596061626364656667686970717273747576777879808182836162636465666768697071727374757677787980818283848586878851 unmodified lines return top_5_results
# Streamlit frontend interfaceimport streamlit as st
def main(): st.title("CPT Description Mapping") st.markdown("<font color='red'>**⚠️ Please ensure the accuracy of your input spellings.**</font>", unsafe_allow_html=True)
st.markdown("<font color='blue'>**💡 Note:** Please note that the similarity scores provided are not indicative of accuracy . Top 5 code description provided should be verified with CPT description by User.</font>", unsafe_allow_html=True)
#user_slider_input_number = st.sidebar.slider('Select similarity threshold', 0.0, 1.0, 0.7, 0.01, key='slider1', help='Adjust the similarity threshold')
# Input text box for user inputuser_input = st.text_input("Enter CPT description:", placeholder="Please enter a full description for better search results.")
# Button to trigger mappingif st.button("Map"): if not user_input.strip(): # Check if input is empty or contains only whitespace st.error("Input box cannot be empty.") elif not validate_input(user_input): st.warning("Please input correct description containing only letters and numbers, or letters only.") else: st.write("Please wait for a moment .... ") # Call backend function to get mapping results try: mapping_results = mapping_code(user_input)#user_slider_input_number # Display top 5 similar sentences st.write("Top 5 similar sentences:") for i, result in enumerate(mapping_results, 1): st.write(f"{i}. Code: {result['Code']}, Description: {result['Description']}, Similarity Score: {float(result['Similarity Score']):.4f}") except ValueError as e: st.error(str(e)) st.markdown("<font color='blue'>**💡 Note:** Please note that the similarity scores provided are not indicative of accuracy. Top 5 code descriptions provided should be verified with CPT descriptions by the user.</font>", unsafe_allow_html=True)
# user_slider_input_number = st.sidebar.slider('Select similarity threshold', 0.0, 1.0, 0.7, 0.01, key='slider1', help='Adjust the similarity threshold')
# Input text box for user input user_input = st.text_input("Enter CPT description:", placeholder="Please enter a full description for better search results.")
# Button to trigger mapping if st.button("Map"): if not user_input.strip(): # Check if input is empty or contains only whitespace st.error("Input box cannot be empty.") elif validate_input(user_input): st.warning("Please input correct description containing only letters and numbers, or letters only.") else: st.write("Please wait for a moment .... ") # Call backend function to get mapping results try: mapping_results = mapping_code(user_input) # user_slider_input_number # Display top 5 similar sentences st.write("Top 5 similar sentences:") for i, result in enumerate(mapping_results, 1): st.write(f"{i}. Code: {result['Code']}, Description: {result['Description']}, Similarity Score: {float(result['Similarity Score']):.4f}") except ValueError as e: st.error(str(e))
if __name__ == "__main__": main()
app.py+27-25