ceejaytheanalyst commited on
Commit
2dc6bf4
·
verified ·
1 Parent(s): 791c8de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -25
app.py CHANGED
@@ -52,35 +52,37 @@ def mapping_code(user_input,user_slider_input_number):
52
  return top_5_results
53
 
54
  # Streamlit frontend interface
 
 
55
  def main():
56
  st.title("CPT Description Mapping")
57
  st.markdown("<font color='red'>**⚠️ Please ensure the accuracy of your input spellings.**</font>", unsafe_allow_html=True)
58
 
59
- 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)
60
-
61
-
62
- #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')
63
-
64
- # Input text box for user input
65
- user_input = st.text_input("Enter CPT description:", placeholder="Please enter a full description for better search results.")
66
-
67
- # Button to trigger mapping
68
- if st.button("Map"):
69
- if not user_input.strip(): # Check if input is empty or contains only whitespace
70
- st.error("Input box cannot be empty.")
71
- elif not validate_input(user_input):
72
- st.warning("Please input correct description containing only letters and numbers, or letters only.")
73
- else:
74
- st.write("Please wait for a moment .... ")
75
- # Call backend function to get mapping results
76
- try:
77
- mapping_results = mapping_code(user_input)#user_slider_input_number
78
- # Display top 5 similar sentences
79
- st.write("Top 5 similar sentences:")
80
- for i, result in enumerate(mapping_results, 1):
81
- st.write(f"{i}. Code: {result['Code']}, Description: {result['Description']}, Similarity Score: {float(result['Similarity Score']):.4f}")
82
- except ValueError as e:
83
- st.error(str(e))
84
 
85
  if __name__ == "__main__":
86
  main()
 
 
52
  return top_5_results
53
 
54
  # Streamlit frontend interface
55
+ import streamlit as st
56
+
57
  def main():
58
  st.title("CPT Description Mapping")
59
  st.markdown("<font color='red'>**⚠️ Please ensure the accuracy of your input spellings.**</font>", unsafe_allow_html=True)
60
 
61
+ 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)
62
+
63
+ # 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')
64
+
65
+ # Input text box for user input
66
+ user_input = st.text_input("Enter CPT description:", placeholder="Please enter a full description for better search results.")
67
+
68
+ # Button to trigger mapping
69
+ if st.button("Map"):
70
+ if not user_input.strip(): # Check if input is empty or contains only whitespace
71
+ st.error("Input box cannot be empty.")
72
+ elif validate_input(user_input):
73
+ st.warning("Please input correct description containing only letters and numbers, or letters only.")
74
+ else:
75
+ st.write("Please wait for a moment .... ")
76
+ # Call backend function to get mapping results
77
+ try:
78
+ mapping_results = mapping_code(user_input) # user_slider_input_number
79
+ # Display top 5 similar sentences
80
+ st.write("Top 5 similar sentences:")
81
+ for i, result in enumerate(mapping_results, 1):
82
+ st.write(f"{i}. Code: {result['Code']}, Description: {result['Description']}, Similarity Score: {float(result['Similarity Score']):.4f}")
83
+ except ValueError as e:
84
+ st.error(str(e))
 
85
 
86
  if __name__ == "__main__":
87
  main()
88
+