Spaces:
Runtime error
Runtime error
Update app.py
Browse files51 unmodified lines525354555657585960616263646566676869707172737475767778798081828384858651 unmodified linesreturn top_5_results# Streamlit frontend interfacedef 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 whitespacest.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 resultstry:mapping_results = mapping_code(user_input)#user_slider_input_number# Display top 5 similar sentencesst.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()51 unmodified lines5253545556575859606162636465666768697071727374757677787980818283848586878851 unmodified linesreturn top_5_results# Streamlit frontend interfaceimport streamlit as stdef 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 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 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 whitespacest.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 resultstry:mapping_results = mapping_code(user_input) # user_slider_input_number# Display top 5 similar sentencesst.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