kartiksrma commited on
Commit
01ec9c3
·
verified ·
1 Parent(s): 9451b58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -20
app.py CHANGED
@@ -113,25 +113,24 @@ if st.button("Search"):
113
  # Generate query embedding
114
  with st.spinner("Fetching results..."):
115
  results = getSearchResults(query, relevance_threshold)
116
- try:
117
- if len(list(results)):
118
- for course in results:
119
- st.markdown(
120
- f"""
121
- ### {course['title']}
122
- - **Description:** {course['description']}
123
- - **Duration:** {course['duration']}
124
- - **Ratings:** {course['ratings']}
125
- - **Difficulty:** {course['difficulty']}
126
- """
127
- )
128
- st.markdown(f"[![Go to Course](https://img.shields.io/badge/Go%20to%20Course-blue)]({course['course_url']})",unsafe_allow_html=True,)
129
-
130
- st.markdown("---")
131
- else:
132
- st.warning("No matches found! Try adjusting the relevance slider or using different keywords.")
133
- except Exception as e:
134
- st.markdown(f"rate limit for searching has been completed try after few minutes\n",e)
135
  else:
136
  st.error("Please enter a query.")
137
-
 
113
  # Generate query embedding
114
  with st.spinner("Fetching results..."):
115
  results = getSearchResults(query, relevance_threshold)
116
+ if results:
117
+ for course in results:
118
+ print(course)
119
+ st.markdown(
120
+ f"""
121
+ ### {course['title']}
122
+ - **Description:** {course['description']}
123
+ - **Duration:** {course['duration']}
124
+ - **Ratings:** {course['ratings']}
125
+ - **Difficulty:** {course['difficulty']}
126
+ """
127
+ )
128
+ st.markdown(f"[![Go to Course](https://img.shields.io/badge/Go%20to%20Course-blue)]({course['course_url']})",unsafe_allow_html=True,)
129
+
130
+ st.markdown("---")
131
+ else:
132
+ st.warning("No matches found! Try adjusting the relevance slider or using different keywords.")
133
+ # except Exception as e:
134
+ # st.markdown(f"rate limit for searching has been completed try after few minutes\n",e)
135
  else:
136
  st.error("Please enter a query.")